Loading
Unified Catalog
Create Service Catalog Requests Using the Create Catalog Request Event Action

Create Service Catalog Requests Using the Create Catalog Request Event Action

Build a screen flow that collects request information and submits a service catalog request with the generic Create Catalog Request Event action. Use this action for a custom intake form that assembles the service process definition request in the flow.

Required Editions

Unified Catalog Editions and Permissions.
User Permissions Needed
To run a flow that creates service catalog requests: Unified Catalog Agent AND Context Service Runtime AND Product Catalog Management Viewer AND Product Discovery User

Create and activate the Unified Catalog service process that the flow uses. Configure its process type, attributes, context definitions, and products before you build the flow.

Gather this information:

  • The Product2 record ID for the service process.
  • The API names and data types of the attributes that the flow collects.
  • The anchor-field mappings for values that the flow writes to the Case, Incident, or Service Request record.
  • The Product2 record IDs of products that requestors select, if the service catalog request includes products.
  • The source record ID, if the flow starts from another record and the service catalog request uses that context.

This task uses the generic Create Catalog Request Event action. The action accepts one Apex-defined service process definition request that you assemble in the flow. To use the dynamic action generated for a specific service process, see Create Service Catalog Request Action.

Add only one Create action to a flow path. This task creates service catalog requests. To update existing requests, see Example Screen Flow to Update Service Catalog Requests.

  1. Create the flow resources.

    In Flow Builder, create a screen flow. Add the Apex-defined variables and collections that store the service process definition request, its attributes, and the action result.

    Create these request and result resources:

    Resource Configuration Purpose
    SvcProcess Apex-defined, SvcProcess__ServiceProcessDefinitionRequest, not a collection Stores the complete service process definition request passed to the Create Catalog Request Event action.
    svcRequestCreationResult Apex-defined, sc_enterprise_catalog__ServiceRequestCreationResult, not a collection Stores the result returned by the action. Select Available for output if another component reads the result.

    SvcProcess is an internal flow resource. Don’t select Available for input or Available for output unless another component passes or receives the complete service process definition request.

    Each custom, context, anchor, or product attribute resource is an instance of SvcProcess__Attribute. Create one single-value variable for each attribute row that the flow builds.

    Create collections for the attribute channels that your service process uses:

    Resource Configuration Purpose
    attrList Apex-defined, SvcProcess__Attribute, collection Stores custom and anchor attribute rows.
    contextAttrList Apex-defined, SvcProcess__Attribute, collection Stores context attribute rows.
    productRequestList Apex-defined, SvcProcess__Attribute, collection Stores product request rows. Create this collection only when the flow submits products.

    The attribute variables and collections are internal working resources. Don’t make them available for input or output.

    Each attribute row contains these properties:

    • key: Identifies the attribute. For an anchor attribute, use the mapped anchor field name.
    • value: Stores the attribute value as text.
    • type: Identifies how the action converts the text value.
    • parentKey: Relates a child attribute to a complex parent attribute.
    • dataAttribute: Optionally specifies the API name used in the request. When this property is empty, the action uses key.

    Supported scalar types are STRING, DATE, DATETIME, INTEGER, DOUBLE, and BOOLEAN. Supported complex types are LIST_OF_STRING, LIST_OF_DATE, LIST_OF_DATETIME, LIST_OF_INTEGER, LIST_OF_DOUBLE, LIST_OF_BOOLEAN, MAP, and LIST_OF_MAP.

  2. Collect the request information.

    Add a Screen element with an input component for each value that the requestor provides. Match each component to the corresponding service process attribute type.

    For example, match these components to attribute types:

    • Use a Text component for a string attribute.
    • Use a Date component for a date attribute.
    • Use a Date & Time component for a datetime attribute.
    • Use a Number component for an integer or decimal attribute.
    • Use a Checkbox component for a Boolean attribute.
    • Use a lookup or another supported selection component for a context record.

    Collect only the attributes and products configured for the service process. The flow assignments use the screen component values to build the service process definition request.

  3. Build the custom and anchor attributes.

    Add an Assignment element after the request screen. For each custom or anchor attribute variable, set key, value, and type with the Equals operator.

    For a custom attribute:

    • Set key to the attribute API name.
    • Set value to the corresponding screen component value.
    • Set type to the attribute’s supported type.

    For an anchor attribute, use the same configuration. Set key to the anchor field name mapped in the service process. The attribute belongs in the standard attributes collection. There isn’t a separate collection for anchor attributes.

    The service process’s attribute-to-field mapping determines whether Unified Catalog writes the value to the Case, Incident, or Service Request record. A key that doesn’t match a mapped anchor field remains a custom attribute and doesn’t populate the anchor record field.

    Add another Assignment element. Use the Add operator to append every custom and anchor attribute variable to attrList.

    For an integer attribute, create a Text formula that removes decimal places from the flow’s number value. Assign the formula result to value and set type to INTEGER. A value such as 34.000 isn’t valid for the INTEGER type.

  4. Build the context attributes.

    Represent each top-level context node with a parent variable and one or more child variables.

    Configure the parent variable:

    • Leave parentKey empty.
    • Set key to the context node’s API name.
    • Set type to MAP.
    • Leave value empty.

    Configure each child variable:

    • Set parentKey to the parent variable’s key.
    • Set key to the child context attribute’s API name.
    • Set value to the corresponding screen component value.
    • Set type to the child attribute’s supported scalar or complex type.

    Use the Add operator to append the parent and all its children to contextAttrList. List order doesn’t define the relationship. Matching key and parentKey values define the context hierarchy.

    Every top-level context node requires the MAP type. The Create Catalog Request Event action rejects a top-level scalar or list context attribute.

  5. If the service catalog request includes products, build the product requests.

    Represent product selections as a LIST_OF_MAP hierarchy. Provide a Product2 record ID for each product to submit. Unified Catalog skips product rows with an empty product ID. If quantity is empty, Unified Catalog uses a quantity of 1.

    1. Create a root attribute variable for the product request collection. Leave parentKey empty, set key to productRequests, set type to LIST_OF_MAP, and leave value empty.
    2. Create a MAP parent variable for each selected product. Set parentKey to productRequests, assign each product a distinct key, set type to MAP, and leave value empty.
    3. Create a product ID child variable for each product. Set parentKey to the corresponding product parent’s key, set key to productId, set value to the product’s Product2 record ID, and set type to STRING.
    4. To specify a quantity, create another child variable. Set parentKey to the corresponding product parent’s key, set key to quantity, set value to an integer represented as text, and set type to INTEGER.
    5. Use the Add operator to append the root, each product parent, and each child to productRequestList.
  6. Assemble the service process definition request.

    Add an Assignment element that populates SvcProcess.

    Configure the fields that apply to the service catalog request:

    Request Field Operator Value
    SvcProcess.spdName Equals The Product2 record ID of the service process
    SvcProcess.isUnifiedCatalog Equals true
    SvcProcess.attributes Add attrList
    SvcProcess.contextAttributes Add contextAttrList
    SvcProcess.productRequests Add productRequestList
    SvcProcess.createdFromRecord Equals Optional. The ID of the record from which the flow started.

    Add only the collections that the service catalog request uses. For example, omit productRequests when the request doesn’t contain products. Set createdFromRecord only when the flow starts from another record and the service catalog request needs that context.

    Leave processTypeRecordId and allowsUpdate empty for request creation. These fields are used together when a flow updates an existing request.

  7. Submit the service catalog request.

    Add the Create Catalog Request Event action after the Assignment elements.

    Set Service Process Definition Request to SvcProcess. The action uses spdName to identify the service process and its Case, Incident, or Service Request process type.

    Store the Service Request Creation Result output in svcRequestCreationResult. Also store Request Outcome Number when the flow needs the created process-type record number as a separate text value.

    The Create Catalog Request Event Action reference lists the action’s inputs and outputs.

  8. Handle the request result.

    Handle failures on the fault path. When the service catalog request can’t be created, the Create Catalog Request Event action returns an error, and the flow follows the fault connector. Add a fault path from the action to an error screen that shows the fault message. The action outputs aren’t reliably set when the action faults, so use the fault message instead of svcRequestCreationResult.

    On the main path, the action successfully creates the service catalog request. Add a confirmation screen that shows svcRequestCreationResult.serviceRequestDetails.anchorEntityNumber, the human-readable number of the created Case, Incident, or Service Request record.

  9. Validate the Create Catalog Request Event configuration.

    Save your changes. Debug the flow with representative custom, context, anchor, and product values.

    If the Create Catalog Request Event action rejects the service process definition request or creates incomplete records, check these requirements:

    • Set SvcProcess.spdName to the service process’s Product2 record ID and set SvcProcess.isUnifiedCatalog to true.
    • Store attribute values as text and use only supported type values.
    • Format dates as yyyy-MM-dd, datetimes as ISO 8601 values, and Boolean values as true or false.
    • Remove decimal places from values that use the INTEGER type.
    • Set every top-level context attribute to MAP, and match each child’s parentKey to its parent’s key.
    • Match each anchor attribute key to the anchor field mapped in the service process.
    • Leave processTypeRecordId and allowsUpdate empty when creating a service catalog request.
  10. Activate the flow after testing succeeds.

The active flow creates service catalog requests and populates the expected Case, Incident, or Service Request fields.

 
正在載入
Salesforce Help | Article