Designing workflows for a repeatable group of questions
To design a workflow to create multiple work orders, one for each set of responses to a repeatable group of questions
For a scenario where you need to provide laptops for new employees, design a workflow that uses the responses to a repeatable group of questions and creates multiple work orders for the procurement of laptops for these employees. When an Object output format is used, the workflow creates multiple work orders, one for each laptop requested.
- Log in to the Catalog console and add a new workflow.
- In the Workflow Designer, create the following process input variables:
- all-instances: Object data type.
From the Document Definition list, select the document definition for a repeatable group of questions.
You configure this document definition in BMC Helix Innovation Studio. - sbcontext (Optional): Service broker context data type
- instance: Object data type, local variable. Represents one instance of answers to the group of questions.
- all-instances: Object data type.
- Add a Sub-Process and configure the following properties:
- Loop Type: Parallel
Loop Data Input: instances
Process variables > all-instances > instances- Input Data Item: instance (the object type local variable you created earlier)
- Add a Create Work Order with Identifiers element inside the Sub-Process.
In the Input Map section for Create Work Order with Identifiers, fill in the following fields:
Input Map parameter
Field value
Notes
Connection ID (required)
Remedy
Information is available from connection category.
Company Name
Company
Information is available from the service broker context.
Customer login ID
Custom Instance Property
User who requires the service. The user must exist in BMC Helix Innovation Suite.
From the Process variables list, select Instance > Custom Property.
- In ${processContext.instance.custom}, replace custom with login.value (where login is an alias). For example, ${processContext.instance.login.value}.
Note: A JSONPath expression specifies a path to an element in a JSON structure. An alias is used in the JSONPath expression to access the answer to a question within an instance of a repeatable group of questions. The local variable instance references one set of answers to the repeatable group of questions. An alias references one of the questions within the group and .value gives access to the answer to the question. When you create a repeatable group of questions for this workflow in the Question Designer, you map an alias to a question in the repeatable group of questions.
Contact login ID (required)
Custom Instance Property
User who submitted the request. The user must exist in BMC Helix Innovation Suite.
${processContext.instance.custom}—Update custom with contactlogin.value (where contactlogin is an alias). For example, ${processContext.instance.contactlogin.value}.
Summary
Service Name
NA
Correlation ID
Process Correlation ID
NA
Description
Service name
NA
Save the workflow.
To design a workflow with an optional repeatable group of questions
A repeatable group of questions can be optional. If a certain condition decides whether a repeatable group of questions should be visible to the user or not, the user might not be able to see or answer those questions. When a user doesn't answer the questions, no instances are added. If the output format is JSON, an error occurs when a user submits a request without adding any instances of answers to the repeatable group. To avoid this issue, use an exclusive gateway that selects which workflow to execute depending on whether a user submits answers to the repeatable group.
For example, let's say you need to provide equipment for a new employee. The repeatable group of questions are displayed to the user only if the user is a new employee. You add an exclusive gateway that selects the workflow that creates work orders only if the user responds to the repeatable group of questions.
The exclusive gateway checks whether all-instances is NULL and works as follows:
- If all-instances is not null, it creates work orders based on the instances.
- If all-instances is null, it does not create any work orders.
For more information about exclusive gateways, see Control-of-workflow-with-gateways.
To add an exclusive gateway
- Log in to the Catalog console and add a new workflow as described in To design a workflow to create multiple work orders, one for each set of responses to a repeatable group of questions.
- Add an exclusive gateway (
) and connect it to the subprocess as shown in the image.
Define the condition for the flow that connects to the End event and configure the condition to evaluate to True if all-instances is null:
- Save your workflow and close the workflow designer.
- Open the Questions Designer.
- Add a conditional question to check whether the requester is a new employee, add questions for the equipment, and click Save.
For more information, see Creating-a-repeatable-group-of-questions.
Where to go from here