You are here:
Example Flow to Create and Update Service Catalog Requests
Design a screen flow that creates service catalog requests and updates existing requests from supported record pages. The flow retrieves existing service process details, controls which attributes a user can update, submits the request, and returns the result to the record page.
Required Editions
| Unified Catalog Editions and Permissions. |
The same screen flow can create and update requests. Keep the create and update logic in separate branches, and retrieve existing values only on the Update branch. To submit the request, use either the service-process-specific Create Service Catalog Request action or the generic Create Catalog Request Event action. Don't add both actions to the same flow path.
| Flow Element | Configuration |
|---|---|
| Flow variables | Store the request information, determine whether the user can update attributes, and return the submission result. |
| Create or Update decision | Route an existing supported record to the Update branch. Route a new request to the Create branch. |
| Set update mode | On the Update branch, set isUpdate to
true. |
| Get Service Process Details action | Retrieve the current attribute values for the record identified by
processTypeId. |
| Request form | Display existing attribute values and control which attributes the user can update. |
| Request action | Submit the request with either the Create Service Catalog Request action or the Create Catalog Request Event action. |
| Post-submission routing | Route the result based on whether the flow created or updated the request. |
| Copy result assignment | Copy the action result to svcRequestCreationResult so that the
record page can display the submission status. |
Configure the Flow Variables
Create the input variables that the record page uses to pass request information to the flow.
| Variable | Data Type | Configuration |
|---|---|---|
isAssignee |
Boolean | Indicates whether the current user is the request fulfiller. Select Available for input. |
isReporter |
Boolean | Indicates whether the current user is the requester. Select Available for input. |
processTypeId |
Text | Stores the ID of the Case, Incident, or Service Request record associated with the service process. Select Available for input. |
currentStatus |
Text | Stores the current status of the record. Select Available for input. |
The flow uses isAssignee, isReporter, and
currentStatus to determine which attributes the user can update. It uses
processTypeId to identify the record to update.
Create an output variable that returns the request submission result to the record page. Also create an internal variable that identifies whether the flow is creating or updating a request.
| Variable | Data Type | Configuration |
|---|---|---|
svcRequestCreationResult |
Apex-defined | Stores the result returned by the request action. Use the
sc_enterprise_catalog__ServiceRequestCreationResult Apex class,
and select Available for output. |
isUpdate |
Boolean | Indicates whether the flow is creating or updating a request. Don't make this variable available for input or output. |
Route the Flow to the Update Branch
Add a Decision element that separates create requests from update requests. In this
example, the Update outcome verifies that processTypeId contains an ID for
one of these supported records:
- Case
- Incident
- Service Request
| Decision Configuration | Description |
|---|---|
| Record ID check | Verify that processTypeId contains a value. |
| Supported record check | Verify that the ID represents a supported Case, Incident, or Service Request record. |
| Update outcome | Route the flow to the Update branch when the conditions are met. |
| Create outcome | Route the flow to the Create branch when the conditions aren't met. |
On the Update branch, add an Assignment element that sets isUpdate to
true. The Create branch retains the default value of
false.
Retrieve the Existing Service Process Details
On the Update branch, add the Get Service Process Details action generated for your service process. Unified Catalog generates a distinct action for each service process. The action name can include the service process name and product ID. The Get Service Process Details Action reference lists the action’s inputs and outputs.
| Action Setting | Configuration |
|---|---|
| Process Type ID | Set the value to processTypeId. |
| Output resources | Use the action outputs to retrieve the current values of the attributes selected for the service process. In this example, the outputs include Account ID, Related Product Requests, Status, and Subject. |
Configure the Request Form
Add an input component for each attribute that users can update. Choose a component that supports the attribute's data type, such as Text, Picklist, Date, Date & Time, or Repeater.
For example, configure the Subject attribute as follows.
| Property | Value |
|---|---|
| Label | Subject |
| API Name | Subject |
| Default Value | GetSvcProcessDetails.Subject |
| Disabled | Select a Boolean formula that determines whether the user can update the attribute. |
Set Default Value to the corresponding output from Get Service Process Details. The current value appears when the user opens the update form.
Create a Boolean formula that evaluates isUpdate,
isAssignee, isReporter, and
currentStatus. The formula returns true when the
component is disabled and false when the component is editable.
In this example, the formula controls whether a requester or fulfiller can update the Subject attribute based on the request status. Configure the formula to mirror the attribute update settings in the service process. Keeping the flow formula consistent with the service process settings prevents the flow's update controls from conflicting with service process validation.
Prefill and Configure the Product Collection Component
If the request form includes a Product Collection (Product Request) component, add the following elements so the component behaves correctly on both the Create and Update paths.
On the Update path, the Product Collection component is read-only and shows only the products that are already selected on the existing request. Users can't add or remove products when updating a request.
Create a text collection variable to hold the IDs of the products that are already selected on the existing request.
| Property | Value |
|---|---|
| API Name | Prefill_SelectedProductIds |
| Data Type | Text |
| Allow Multiple Values (Collection) | Selected |
After the Get Service Process Details action on the Update branch, add a Loop element that iterates over the existing request's selected products.
| Property | Value |
|---|---|
| API Name | Prefill_SelectedProductsLoop |
| Collection Variable | The selected-products collection returned by Get Service Process Details. |
| Direction | First Item to Last Item |
Inside the loop, add an Assignment element to append each product ID to
Prefill_SelectedProductIds.
| Property | Value |
|---|---|
| API Name | Prefill_SelectedProductsAssignment |
| Variable | Prefill_SelectedProductIds |
| Operator | Add |
| Value | The current loop item's product ID. |
On the Product Collection component, bind the following properties.
| Property | Value |
|---|---|
| Preselected Product IDs | {!Prefill_SelectedProductIds} |
| Read Only Mode | {!isUpdate}, or the equivalent variable that indicates the
flow is running the Update path. |
| Product ID | The product ID field from the product collection record. |
| Product Selection Status | The selection-status field from the product collection record. |
On the Create path, the Product Collection component starts empty and is editable, so users can select products as usual. On the Update path, the component shows the products that are already on the request and doesn't let users change the selection.
Submit the Request with the Create Service Catalog Request Action
Use this configuration when your flow uses the service-process-specific Create Service Catalog Request action. Add the action after the request form, and map the form values to the corresponding action inputs. The Create Service Catalog Request Action reference lists the action’s inputs and outputs.
| Action Input | Configuration |
|---|---|
| Allows Update | Include the input and set its value to isUpdate. |
| Process Type ID | Include the input and set its value to processTypeId. |
| Service process attributes | Map the screen component values to the corresponding action inputs. |
When isUpdate is true, the action updates the record
identified by processTypeId. When isUpdate is
false, the action creates a service request.
Return the Create Service Catalog Request Result
On the Update outcome of the post-submission Decision element, add an Assignment element that copies the action result to the flow output variable.
| Assignment Setting | Configuration |
|---|---|
| Variable | svcRequestCreationResult |
| Operator | Equals |
| Value | Select the Service Catalog Request Result output from the Create Service
Catalog Request action. In this example, the action element is named
ActionDetail. |
The record page uses the output variable to display a toast message that confirms the update or reports an error.
Submit the Request with the Create Catalog Request Event Action
Use this configuration when you replace the service-process-specific Create Service Catalog Request action in a generated flow or add update support to a flow that already uses the Create Catalog Request Event action. The Create Catalog Request Event Action reference lists the action’s inputs and outputs.
If the flow already contains the variables, attribute collections, and assignments required by Create Catalog Request Event, keep the existing configuration and add only the update-specific assignments described in this section.
If you replace the Create Service Catalog Request action in a generated flow, create the
variables and assignments required by Create Catalog Request Event. Build the attribute
values, add them to the appropriate collections, and populate the service process definition
request variable. In this example, the variable is SvcProcess.
The Build Attributes and Add to List assignments are part of the standard Create Catalog Request Event configuration and aren't specific to updating requests. To configure these assignments, see Create Service Catalog Requests Using the Create Catalog Request Event Action.
In the Set SvcProcess Assignment element, add these update-specific assignments.
| Variable | Operator | Value |
|---|---|---|
SvcProcess.processTypeRecordId |
Equals | processTypeId |
SvcProcess.allowsUpdate |
Equals | isUpdate |
Add the Create Catalog Request Event action after the assignment elements.
| Action Input | Configuration |
|---|---|
| Service Process Definition Request | Set the value to SvcProcess. |
Return the Create Catalog Request Event Result
If you replace the service-process-specific action with Create Catalog Request Event,
update the action references in the Assignment_CopyResult and Confirmation
elements.
On the Update outcome of the post-submission Decision element, configure the result assignment as follows.
| Assignment Setting | Configuration |
|---|---|
| Variable | svcRequestCreationResult |
| Operator | Equals |
| Value | Select the svcRequestCreationResult output from the Create
Catalog Request Event action. In this example, the action element is named
Create_Catalog_Request_Event, and the result is
Create_Catalog_Request_Event.svcRequestCreationResult. |
Update the Confirmation element to use the result from the Create Catalog Request Event action instead of the result from the replaced Create Service Catalog Request action. The record page uses the output variable to display the result of the update.
