How to attach workflow in my Order guide through process engine
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2024 01:47 PM
1 REPLY 1
Community Alums
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2024 09:30 PM
Hi @Affanahmadd ,
Running an order guide from a workflow is suitable if you include order guides as part of a broader workflow-based process.
For example, an activity within an onboarding workflow for a new employee can automatically run an order guide to order items for that employee.
Note: When order guides run automatically, order guide UI policies are not enforced. Also, options in the Choose Options screen cannot be selected, so make sure that order guide rules define sensible defaults for these options to avoid processing failures.
To run order guides from a workflow, use the Scriptable Order Guide workflow activity.
Field | Description |
---|---|
Order Guide | The name of the order guide that this activity processes. For example, Example Employee Onboarding IT. |
Script | A script passing information to the order guide. This information is sent as a JSON encoded string parameter assigned to the answer variable.
The script must meet these requirements:
|
Results
- Success: the activity successfully processed the order guide. This does not mean a request was created. If a request was created, the request sys_id is added to the workflow scratchpad under the sc_request variable.
- Failure: while processing the order guide a failure occurred, creating a failure record. If the processing fails, you can view and edit the failure record.
Workflow example
The Example Employee Onboarding IT Workflow workflow uses this example to generate IT catalog items for a new employee as part of an onboarding process.
The activity uses this script to:
- Take a JSON string generated previously from the HR change record.
- Append the mandatory opened_by and requested_for parameters to that string.
- Submit the new string for processing by the order guide.
var parameters = new JSON().decode(current.payload);
// Need to amend the json object to include additional values.
parameters.opened_by = current.opened_by + "";
parameters.requested_for = current.opened_for + "";
answer = new JSON().encode(parameters);