Workflow is series of activities that follows execution path.
An Activity is a collection of instructions that can include script, logging, approvals, record processing, timers, wait time, rollback activity etc.
To create a workflow we need to go for workflow editor and we can drag and drop required activity in workflow.
We can also drag and drop any other workflow in current workflow.
We can create scratchpad variable to pass values from one activity to another.
If we are using If activity then we can specify condition as follows-
To send data from main workflow to sub workflow we need to create one input variable in sub workflow to hold value coming from main workflow as follows-
We can specify input filed name, type, length etc as follows-
Create scratchpad variable in main workflow
Set value coming from main workflow to input variable Trainer Course
To access value coming in input variable assign it to some other filed like short description
To test this run the catalog item. Add Trainer name as Meghana. then automatically data present is scratchpad variable will be passed to sub workflow. After providing approval, check the workflow. short description should hold data coming from main workflow i.e. Service Now.
To send data back from sub workflow to main workflow we need to create scratchpad variable in sub workflow as follows –
Then need to create return activity as follows and specify scratchpad variable as ${workflow.scratchpad.cost}
Now go to main workflow and set map return value to as follows-
Then assign the value coming from sub workflow to description filed as follows,
Main Workflow-
Sub Workflow –
Result-
Create Following Group’s
1.Email Group
2.Phone Group
3.Self Group
4.Walk_in Group
Create new state for Incident state field i.e. Waiting for Approval
Incident Workflow
|
|
Wait till the asigned to field should get value
|
set state=Waiting for Approval
|
|
Go for the approval according to Contact Type
1.Email ——Email Group
2.Phone ——Group
3.Self ——–Group
4.Walk_in ——Group
Any approval reject, it will go to run script activity where we should change the state=Canceled and then end the workflow
After Approval
|
|
|
Another approval should get trigger to Incident’s Caller’s Manager
IF the it reject , it will roll back to again the previous group approval
After approval it will go further
|
|
|
Change the state=In Progress
|
|
|
After this there should be 2 parallel process.
1. if user canceled or closed the incident,then the workflow should end.
2. if user changed the priority then put comments as “Priority changed” and go to Activity of Caller’s Manager Approval.
but this priority changes can be done 2 times, if user is trying to do it for 3 times, then change the state=resolved
and end the workflow.
Incident Form Field Task
1.Contact type field should have default value=Self Service
2.User should not change the contact type field value once he submit the form
3.User should not submit the form without categoy and subcategory field values
Branch flow Activity:
Join flow Activity:
Example:
Create Branch
Setting the values parallel for branch
Create approval user and group for join the activities
Create Join for two activities are approval user and approval group
Workflow for join and branch:
Output:
Branch output set the values for short description and description
Join output:
Once the user and group are approved the join go to end
Incomplete Join:
Usecase1:
If both approval user and approval group are approved then it show as complete. If approval user is approved and approval
group is rejected then it go as incomplete state.
Output for incomplete join:
Reject the approval for approval group and approved the approval user
Now it is in incomplete state then it go to end
If it is both are approved then it make as complete and go to end:
Usecase2:
If approval user is approved and approval group is rejected then it go incomplete then rollback condition will execute
Here the approval group is rejected then it go to incomplete state and then move to rollback condition,it execute rollback
condition
Output: Here the rollback condition is applied for incomplete state in Join Activity
ROLLBACK:
It used to loop back to some activity and in the path, it nullifies the current set values. For creating a rollback to activity,
go to core and choose rollback to from approvals and drag it into the workspace.
In this, the rollback condition applies if the approval from managers is not obtained. The rollback condition will make the process
go back to switch condition.
Incident is created
Waiting for approval
Approved by manager:
Approval denied by manager:
I can be seen that the value has been changed to not yet requested
In the workflow, after going to roll back it can be seen that the flow is redirected to the switch statement
TURNSTILE:
It is an iterative activity which can be used to control how many times the workflow passes through a particular segment of the
workflow. To create a turnstile activity, simply click on core and choose utilities and drag and drop turnstile on to the workspace
Here this activity has been set after a wait for condition for priority to change and the allowed iterations is set to 1, if the priority
changes the workflow will continue as usual. This is used so that the loop does not continue infinitely and only passes through
for the set number of iterations.
In the below example, one can observe how turnstile works for changing priority.
Incident is created:
Priority changed for the first time:
It can be seen that the workflow goes through continue and proceeds to get approval from manager again:
Changing the priority for the second time:
It can be seen that the workflow goes through cancel: