10.4 Leveraging Sub-Workflows
Key Takeaways
A subprocess is a complete workflow with its own Start and Stop, called from a step through a WorkflowRef; the calling workflow waits until it finishes.
Subprocess workflows are conventionally given the Subprocess type, which marks them as parts of larger workflows.
Arg elements pass values in, and Return elements copy subprocess variables back; merge="true" appends to list variables instead of replacing them.
Step replication launches one subprocess per item in a list so the items can finish independently.
LCM Provisioning is built from subprocesses such as Identity Request Initialize, Provisioning Approval Subprocess, Identity Request Provision, and Identity Request Finalize.
Leveraging Sub-Workflows
Objective 4.6 asks you to understand how sub-workflows can be leveraged. A subprocess is simply another workflow that a step launches. Control passes to it until it completes, and then the calling (master) workflow continues. SailPoint gives three benefits of splitting complex workflows into subprocesses:
- A simpler master workflow, which reads as a list of high-level stages.
- Easier management, because each stage is small enough to understand and test.
- Reuse, because many master workflows can call the same subprocess.
Declaring and Calling a Subprocess
A subprocess is a complete workflow, with Start, Stop, and its own steps and variables. By convention its type is Subprocess, which ties it to no system trigger but marks it as part of a larger workflow. In the Process Designer, set a step's action to Subprocess and choose from workflows of that type.
In XML, the calling step contains a WorkflowRef, arguments, and returns:
<Step icon="Task" name="Initialize">
<Arg name="flow" value="ref:flow"/>
<Arg name="formTemplate" value="string:Identity Update"/>
<Arg name="identityName" value="ref:identityName"/>
<Return name="project" to="project"/>
<Return name="workItemComments" to="workItemComments" merge="true"/>
<WorkflowRef>
<Reference class="sailpoint.object.Workflow" name="Identity Request Initialize"/>
</WorkflowRef>
<Transition to="Approve"/>
</Step>
Passing Data In: Arg
Each Arg sets a variable in the subprocess. The subprocess should declare matching input="true" variables. As in other arguments, the value can be string, script, rule, call, ref, or $().
Passing Data Back: Return
| Return attribute | Meaning |
|---|---|
name | The variable in the subprocess |
to | The variable in the calling workflow. It can be omitted when the names match, but including it is best practice. |
value | Optional transformation of the returned value (string, script, rule, call, or ref) |
merge="true" | For lists: append to the caller's list instead of replacing it |
local | Approvals only: keep the value in the parent approval's local storage instead of a workflow variable |
A normal step returns one value through resultVariable. A subprocess step can return many values through several Return elements. That is one reason to use subprocesses. Return elements must be written in XML, because the UI has no editor for them.
Step Replication
When you choose a subprocess in the designer, you can enable step replication. You pick a list from the master workflow and the argument that receives each item. IdentityIQ launches one subprocess per item, all passed through the same argument, so the items run to completion independently instead of one after another. For example, one approval subprocess per approver can take each approved item all the way to provisioning without waiting for every other approver.
Subprocesses in the Product
The most important example is LCM Provisioning (section 4.3). Its steps call:
- Identity Request Initialize – builds the request, compiles the plan, and checks policies
- Identity Request Violation Review – interactive policy handling
- Identity Request Approve and Provisioning Approval Subprocess – builds approvals
- Do Provisioning Forms – collects missing data
- Identity Request Provision (with Provision with Retries) – provisions
- Identity Request Notify – sends notifications
- Identity Request Finalize – called from a
catches="complete"step
Lifecycle event workflows reuse some or all of the same subprocesses. When you customize a stage, such as notifications, copy just that subprocess, point your copy of the master workflow at it, and leave the rest alone.
Worked Example: Extracting a Notification Stage
A team has three custom lifecycle workflows (joiner, mover, and leaver) that each end with 40 lines of nearly identical email logic. Refactoring it:
- Create ACME Notify Manager with type Subprocess. Give it input variables
identityName,templateName, andextraRecipients, and an output variablenotified. - Move the email steps into it, ending at Stop.
- In each lifecycle workflow, replace the old steps with one step whose
WorkflowRefnames the subprocess. Pass the threeArgvalues and add<Return name="notified" to="notified"/>. - Test each master workflow with trace on and Redirect to File (section 3.4).
A later change to the notification wording is now made once, in one object, and every lifecycle workflow picks it up.
Choosing the Right Reuse Mechanism
| Need | Best choice | Why |
|---|---|---|
| Reuse a few lines of logic | Rule or rule library method (section 9.1) | Lightweight; no workflow state |
| Reuse a whole stage with approvals, forms, and waits | Subprocess | Has its own steps, approvals, and many return values; the caller waits |
| Kick off unrelated work and keep going | scheduleWorkflowEvent | Launches a separate workflow, optionally delayed; the caller does not wait |
| Same stage for many items independently | Subprocess with step replication | One subprocess per item |
Pitfalls
- Missing inputs. If the subprocess expects
identityNameand the caller does not pass it, the subprocess runs with null. Mark critical variablesrequired="true". - Forgetting Return. Changes made inside the subprocess are not visible to the caller unless they are returned.
- Overwriting lists. Use
merge="true"when both workflows add to a list, such as comments. - Type confusion. A subprocess of type Subprocess will not appear in trigger drop-downs such as the LCM Business Processes tab. That is intended, because it is meant to be called, not triggered.
A master workflow calls a subprocess that builds a provisioning project and a list of comments. How does the master workflow receive both values?
Through the step's resultVariable, which holds both values
Through two Return elements on the subprocess step, using merge="true" for the comments list if it should be appended
Through the subprocess's Send list
It cannot; subprocesses can only return a Boolean
What is the key behavioral difference between calling a workflow as a subprocess and launching it with scheduleWorkflowEvent?
A subprocess makes the caller wait until it completes, while scheduleWorkflowEvent starts an independent workflow and the caller continues.
Subprocesses run only on the Task host, while scheduled workflows run on UI hosts.
scheduleWorkflowEvent can return values, while subprocesses cannot.
There is no difference; both run inline.
A step must send the same approval subprocess to five approvers so that each approved item can be provisioned without waiting for the others. Which feature supports this?
A catches="complete" step
A child approval with mode serial
Step replication on the subprocess step, using the list of approvers or items
The workflow's explicitTransitions attribute
Why are subprocess workflows conventionally given the Subprocess type?
The type makes them run faster.
The type allows them to be triggered by lifecycle events only.
The type is required for Return elements to work.
The type is not tied to any system trigger, and it marks the workflow as part of a larger workflow.
Sections you finish are checked off in the contents.