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- Following is the main workflow and we have added one sub workflow in main workflow. Sub Workflow- 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- Incident Workflow Assignment Create Following Group’s 1.Email Group2.Phone Group3.Self Group4.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 Group2.Phone ——Group3.Self ——–Group4.Walk_in ——Group Any approval reject, it will go to run script activity where we should change the state=Canceled and then end the workflowAfter Approval | | |Another approval should get trigger to Incident’s Caller’s ManagerIF the it reject , it will roll back to again the previous group approvalAfter 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=resolvedand end the workflow. Incident Form Field Task 1.Contact type field should have default value=Self Service2.User should not change the contact type field value once he submit the form3.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 activityproperties form displays, enter the branch name and click Submit to add the activity to the canvas, then click AddCondition. 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 screenand click Submit. Use this activity for a workflow to wait for all activities in multiple paths to finish before it continuing. If multiple concurrentworkflow 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 havecompleted and transitioned to the Join. Incomplete: Joinexits along the Incomplete path when the system determines that at least one predecessor activitycompleted 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 weuse 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 toend -> 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