LogiUpSkill

Sub - Workflow

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-

Workflow in ServiceNow
  1. Following is the main workflow and we have added one sub workflow in main workflow.
  1. Sub Workflow-
Workflow in ServiceNow

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-

Workflow in ServiceNow

We can specify input filed name, type, length etc as follows-

Workflow in ServiceNow

Create scratchpad variable in main workflow

Workflow in ServiceNow

Set value coming from main workflow to input variable Trainer Course

Workflow in ServiceNow

To access value coming in input variable assign it to some other filed like short description

Workflow in ServiceNow

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.

 

Workflow in ServiceNow

To send data back from sub workflow to main workflow we need to create scratchpad variable in sub workflow as follows –

Workflow in ServiceNow

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-

Incident Workflow Assignment

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 and Join

       Branch flow Activity:

  • The Branch activity is used to run the two activities parallel.
  • The Branchactivity splits the workflow into multiple transition paths from a single activity.
  • To add a transition path, select and drag the Branchactivity into the canvas. Then you can see the Branch activity
    properties form displays, enter the branch name and click Submit to add the activity to the canvas, then click Add
    Condition.
  • All transitions from this activity execute concurrently. This activity provides a single Always
  • You can execute any number of transitions from this condition.
  • Branching can affect the behavior of rollback activities.

             Join flow Activity:

  • The Join activity combines multiple execution paths into one transition path.
  • To add Join to the canvas, Drag the join into the canvas and enter the name of join in the properties screen
    and click Submit.
  • Use this activity for a workflow to wait for all activities in multiple paths to finish before it continuing. If multiple concurrent
    workflow paths meet without a join activity, any subsequent activities execute two times.
  • Connect incoming transitions from each activity you want to act as a predecessor to the Join activity.
  • There will be two exit condition for the outgoing transitions: Complete and Incomplete.
  • Complete: Joinexits along the Complete path when the system has determined that all predecessor activities have
    completed and transitioned to the Join.
  • Incomplete: Joinexits along the Incomplete path when the system determines that at least one predecessor activity
    completed but transitioned along a path that bypassed the Join

             Example:

  • We have to set values for short description and description parallel when the wait for condition is true ->For that we
    use Branch to run the two activity concurrently.
  • We have to join two activity for approval user and approval group is approved then both condition satisfy it go to
    end -> For that we use Join to join that two activities.

             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

TURNSTILE AND ROLLBACK

     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:

Workflow