Using responses from a connected system in your workflow
Some workflow activity elements move data through a workflow, while other elements send data to a connected system. Activities that send data to a connected system can also receive a response. To drive decision flows, complete forms, or send as data to another workflow activity, you can build an expression with one or more response properties from activities that appeared earlier in the workflow.
Example of a single response returned to the workflow activity
Some systems send a response to BMC Digital Workplace Catalog as a single text string. For example, the Is Flexera License Needed Flexera connector activity expects a response from the Flexera App Portal that contains a 1 or 0, where 1 represents True. The unnamed response is a raw value that is supplied to the Output
parameter of the connector activity.
The following illustration shows the portion of a workflow where an exclusive gateway that redirects the sequence flow based on a condition that tests the value the returned response from the Is Flexera License Needed activity.
Example of a response with multiple values in an expected structure
Some systems send a response to BMC Digital Workplace Catalog in a structure that maps to predefined variables that the activity expects. For example, the Get Remedy Work Order by Id Remedy connector activity expects a response from a Remedy ITSM system that contains a defined structure.
The following illustration shows an example of an expression that inserts the Summary variable from the list in the Available Values column.
Before you begin
Capture process information and pass it into the workflow.
To use a single response variable in an expression
When the structure of a response is a single value or a predefined variable structure, you can build expressions with variables that you insert from the Available Values column. When the workflow runs, the variables are replaced by the values from the response.
The following example shows multiple ways of inserting a single variable into the expression builder at various points in the workflow. The end result is an incomplete workflow that demonstrates only the the decision flow portion that is based on a conditional expression.
- Create a service broker context variable to populate one of the input fields (variable name:
sbcontext
). See Adding a process context variable to a workflow. While editing a workflow, insert an activity that receives a single value.
For example, insert the Is Flexera License Needed activity.
With the activity highlighted, open the expression builder to populate the following parameters:
- Connection ID—Insert the
Connection Id
property. - Service—Expand to find and insert the service broker context property
sbcontext > Service > External Service ID
.
For each parameter, click the gray plus sign to add the property parameter. For example, you can insert the
External Service ID
property into the expression as shown in the following illustration.- Connection ID—Insert the
After the Is Flexera License Needed activity, insert an exclusive gateway:
Before you can build a conditional expression to direct the sequence flow, you must add two activities to use as choices.
Add the following activities as examples to demonstrate the decision flow.
- From the Flexera group, add Check Flexera Available Licenses.
- From the Expressions group, add Compute Value.
You can replace these activities to meet your specific use cases later.
Draw sequence flows to connect the elements.
Click the sequence flow to the Check Flexera Available Licenses activity, and click the link to open the expression builder.
Click the gray plus sign next to
Output
to insert the property into the expression, and type= 1
to set the condition.You have just created a workflow decision flow that checks for one condition, as shown in the following illustration.
An exclusive gateway can evaluate any number of conditional expressions, as long as one of the sequence flows is set without a condition for use as the default. For more information, see Control of workflow with gateways.
Example of a response with multiple values returned in a dynamic structure
Some systems send a response to BMC Digital Workplace Catalog in a structure that the activity is not prepared to extract into predefined variables. For example, the Remedy connector activity Get Entry receives a response from a Remedy ITSM system that contains a JSON description of the response. The connector activity cannot separate the response into predefined variables. However, if you know the structure of the response, you can assign specific properties of the response to variables that you define.
The following illustration shows an example of how you can use the custom property variable in an expression.
When you select an activity, select its Output > Custom Property. The output values are displayed in JSON format in the Expression Builder.
To create custom variables from a response with a dynamic structure
The following example shows how you can build a complete workflow that queries a Remedy ITSM system for data, and sends a dashboard notification with custom variables that have been mapped to specific response properties.
Verify the data structure of the response object to expect.
This example uses the Get Entry Remedy connector activity to query the CTM:People records for information about a specific user record. The following code shows the JSON structure of a CTM:People record that shows the properties with sample values. The specific data structure you receive will be different if you are querying against a different form or connecting to a different system.
Note: In the 19.08 version of BMC Digital Workplace Catalog, the Date field sent through the Build Input Set activity or from ITSM is not converted to the correct value—
{"value":2458536}
.Response from a CTM:People record represented as a JSON string{ "Time Zone":"(GMT-05:00) Eastern Time (US & Canada)", "Phone Number Home":"1 212", "CC Business Fax":"1", "Area Pager":"212", "Department":"Customer Service", "Hourly Rate":{ "valueString":"0.00", "currencyCode":"USD", "conversionDate":{ "value":1298839192 }, "funcCurrencyList":[ { "valueString":"0.00", "currencyCode":"USD", "value":0.0 }, { "valueString":"0", "currencyCode":"GBP", "value":0 }, { "valueString":"0", "currencyCode":"EUR", "value":0 }, { "valueString":"0", "currencyCode":"JPY", "value":0 }, { "valueString":"0", "currencyCode":"CAD", "value":0 } ], "value":0.0 }, "Profile Status":"Enabled", "Phone Number Pager":"1 212", "Site ID":"STE_SOLN0002846", "Site Zip/Postal Code":"10036", "Area Mobile":"212", "Local Business":"555-5454", "Site Group":"United States", "Home City":"New York", "Internet E-mail":"F.Stafford@calbroservices.com", "Assignment Availability":"Yes", "Cost Center Code":"11111-1111", "Default Country":"United States", "ManagersName":"Ian Plyment", "Site State Province":"New York", "Last Name":"Stafford", "ManagerLoginID":"Ian", "Site":"Headquarters, Building 1.31", "Home Street":"1114 Eighth Avenue, 31st Floor", "Status History":"1298839192\u0004Demo\u00031298839192\u0004Demo\u0003", "Organization":"Information Technology", "Default Zip/Postal Code":"10036", "JobTitle":"Support Staff", "Default City":"New York", "instanceId":"AG00123F73CF5ERkUTSQCDkZAAhaQA", "Home State Province":"New York", "Number Ticket Assigned":175, "Home Time Zone":"(GMT-05:00) Eastern Time (US & Canada)", "Area Pager NT":"212", "PrimaryCostCenterInstance ID":"FNGAA5V0GFCSKAOU72KAOTLF1KO82L", "Phone Number Mobile":"1 212", "ExternalPassword":"W+idXK+Iq6HHas4X8vkcJtfA==", "Area Home":"212", "Short Description":".", "Default State Province":"New York", "DataTags":"SOLUTIONDATA", "CC Business":"1", "Last Modified Date":{ "value":1508947721 }, "Company":"Calbro Services", "CC Pager":"1", "Default Street":"1114 Eighth Avenue, 31st Floor", "Area Business":"212", "First Name":"Francie", "Full Name":"Francie Stafford", "Support Staff":"Yes", "Home Country":"United States", "Phone Number Pager NT":"1 212", "License Type":"Floating", "Locale2":"en_US", "Site Country":"United States", "Last Modified By":"Remedy Application Service", "Extension Business":"55", "Assignee Groups":"1000000001;", "ReconciliationIdentity":"OI-53EEE8C5DAA748E1AC8F4953F081F100", "Region":"Americas", "Submit Date":{ "value":1226003986 }, "Home Zip/Postal Code":"10036", "Site City":"New York", "Phone Number Business":"1 212 555-5454 (55)", "CC Home":"1", "CC Mobile":"1", "Cost Center Name":"11111-1111", "Submitter":"Demo", "Notification Availability":"Yes", "Remedy Login ID":"Francie", "Default Notify Mechanism":"E-mail", "Client Sensitivity":"Standard", "CC Pager NT":"1", "In-Line RE Job Calls":"Inline", "Site Street":"1114 Eighth Avenue, 31st Floor", "Client Type":"Office-Based Employee", "Title":"Ms.", "Unrestricted Access":"Yes", "Person ID":"PPL000000000021", "Phone Number Fax":"1 212", "Last Ticket Assigned":1.508947721107E12, "Full Text License Type":"None", "Default Time Time Zone":"(GMT-05:00) Eastern Time (US & Canada)", "Area Business Fax":"212", "VIP":"No", "Open Tasks":0 }
- From the properties pane of a new workflow, click Add/Remove Variables.
Click Add Variable and create a
RequestedPersonID
variable to receive a Person ID value to search.For example, to create the
RequestedPersonID
variable, set the following properties:- Name—Enter any text, such as
RequestedPersonID
. - Input/Output Parameter—Select Input and Input Required.
- Data Type—Select Text.
TheRequestedPersonID
variable will contain a Person ID value that a user will submit at the time of the request.- Name—Enter any text, such as
- Click Save.
Insert a Get Entry activity onto the workflow, and click the link to open the expression builder.
Enter the following properties:
- Connection Id—Click the gray plus sign to insert the
Connection Id
property. - Form Name—Enter
"CTM:People"
in double quotation marks to specify the form to query against. - Request Id—Click the gray plus sign to insert the
RequestedPersonID
variable as the value to search.
Create output parameters to map to the following properties from the JSON representation in Step 1.
Output parameter name Response property key Example property value (see the JSON representation) Site Name Site
Headquarters, Building 1.31
Cost Center Cost Center Code
11111-1111
Note
Name and Response property key values must be different for a single output parameter.
- Connection Id—Click the gray plus sign to insert the
In the Properties pane, under Output Map, click Add to create an output parameter.
Enter Site Name, and then press Enter to save the name.
Click the link to open the expression builder to specify the source for the Site Name output parameter.
Expand the Get Entry > Output property, and click the gray plus sign beside Custom Property to insert an
activityResults
property string, as in the following illustration.Inside the
activityResults
string, replace the word "custom" with the name of the response property to insert; for example:Site
.
Note
When you attach the response property key to the output parameters that you create, you must enter the property name in the
activityResults
string exactly as the desired property key in the response; otherwise, the source of the output parameter will be empty.- Click OK to save this output parameter mapping.
Repeat steps 6 through 11 to create an output parameter named Cost Center, and specify the source as the response property:
Cost Center Code
(as shown in the following illustration):Insert a Send In App Notification activity onto the workflow, and open the expression builder.
Enter the following properties:
Receiver—Enter
"hannah_admin"
or the user name of another catalog administrator in double quotation marks to specify the user who will receive the dashboard notification.- Title—Enter
"Requested person info: " +
and then click the gray plus sign to insert and concatenate theRequestedPersonID
property. Content—Concatenate the text and output parameters together to build the expression
"Site: " + Site Name + " - Cost Center: " + Cost Center
.
The following illustration shows the content of this expression:
Complete the workflow by drawing sequence flows to join the elements, as shown in the following illustration.
When you can attach this workflow to a service, you must create a questionnaire that receives a value for the
RequestedPersonID
variable from the user.
Comments
Log in or register to comment.