You are here:
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.
-
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 SvcProcessApex-defined, SvcProcess__ServiceProcessDefinitionRequest, not a collectionStores the complete service process definition request passed to the Create Catalog Request Event action. svcRequestCreationResultApex-defined, sc_enterprise_catalog__ServiceRequestCreationResult, not a collectionStores the result returned by the action. Select Available for output if another component reads the result. SvcProcessis 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 attrListApex-defined, SvcProcess__Attribute, collectionStores custom and anchor attribute rows. contextAttrListApex-defined, SvcProcess__Attribute, collectionStores context attribute rows. productRequestListApex-defined, SvcProcess__Attribute, collectionStores 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 useskey.
Supported scalar types are
STRING,DATE,DATETIME,INTEGER,DOUBLE, andBOOLEAN. Supported complex types areLIST_OF_STRING,LIST_OF_DATE,LIST_OF_DATETIME,LIST_OF_INTEGER,LIST_OF_DOUBLE,LIST_OF_BOOLEAN,MAP, andLIST_OF_MAP. -
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.
-
Build the custom and anchor attributes.
Add an Assignment element after the request screen. For each custom or anchor attribute variable, set
key,value, andtypewith the Equals operator.For a custom attribute:
- Set
keyto the attribute API name. - Set
valueto the corresponding screen component value. - Set
typeto the attribute’s supported type.
For an anchor attribute, use the same configuration. Set
keyto 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
valueand settypetoINTEGER. A value such as34.000isn’t valid for theINTEGERtype. - Set
-
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
parentKeyempty. - Set
keyto the context node’s API name. - Set
typetoMAP. - Leave
valueempty.
Configure each child variable:
- Set
parentKeyto the parent variable’skey. - Set
keyto the child context attribute’s API name. - Set
valueto the corresponding screen component value. - Set
typeto 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. MatchingkeyandparentKeyvalues define the context hierarchy.Every top-level context node requires the
MAPtype. The Create Catalog Request Event action rejects a top-level scalar or list context attribute. - Leave
-
If the service catalog request includes products, build the product requests.
Represent product selections as a
LIST_OF_MAPhierarchy. 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.-
Create a root attribute variable for the product request collection. Leave
parentKeyempty, setkeytoproductRequests, settypetoLIST_OF_MAP, and leavevalueempty. -
Create a
MAPparent variable for each selected product. SetparentKeytoproductRequests, assign each product a distinctkey, settypetoMAP, and leavevalueempty. -
Create a product ID child variable for each product. Set
parentKeyto the corresponding product parent’skey, setkeytoproductId, setvalueto the product’s Product2 record ID, and settypetoSTRING. -
To specify a quantity, create another child variable. Set
parentKeyto the corresponding product parent’skey, setkeytoquantity, setvalueto an integer represented as text, and settypetoINTEGER. -
Use the Add operator to append the root, each product parent, and each child to
productRequestList.
-
Create a root attribute variable for the product request collection. Leave
-
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.spdNameEquals The Product2 record ID of the service process SvcProcess.isUnifiedCatalogEquals trueSvcProcess.attributesAdd attrListSvcProcess.contextAttributesAdd contextAttrListSvcProcess.productRequestsAdd productRequestListSvcProcess.createdFromRecordEquals Optional. The ID of the record from which the flow started. Add only the collections that the service catalog request uses. For example, omit
productRequestswhen the request doesn’t contain products. SetcreatedFromRecordonly when the flow starts from another record and the service catalog request needs that context.Leave
processTypeRecordIdandallowsUpdateempty for request creation. These fields are used together when a flow updates an existing request. -
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 usesspdNameto 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.
-
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. -
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.spdNameto the service process’s Product2 record ID and setSvcProcess.isUnifiedCatalogtotrue. - Store attribute values as text and use only supported
typevalues. - Format dates as
yyyy-MM-dd, datetimes as ISO 8601 values, and Boolean values astrueorfalse. - Remove decimal places from values that use the
INTEGERtype. - Set every top-level context attribute to
MAP, and match each child’sparentKeyto its parent’skey. - Match each anchor attribute key to the anchor field mapped in the service process.
- Leave
processTypeRecordIdandallowsUpdateempty when creating a service catalog request.
- Set
- Activate the flow after testing succeeds.
The active flow creates service catalog requests and populates the expected Case, Incident, or Service Request fields.
