Calling Flow designer from Workflow When using both workflow and flow designer for service catalog
Calling Flow designer from Workflow When you are using both workflow and flow designer for service catalog
1. Before implementing this hope you have installed Flow Designer support for the Service Catalog(com.glideapp.servicecatalog.flow_designer) plugin and created catalog item.
2. Create Flow designer.
Flow Designer --> Designer --> New
3. Add Trigger condition as Service Catalog.
4. Add First Action as Get Catalog variable.
In which here need to provide Catalog Item name.
Please refer the below snap.
5. Create Workflow
Workflow --> Workflow Editor --> New Workflow
Add one core activity "Run Script".
6. Add below script in the run script :
var flowInputs = {}; flowInputs['request_item'] = current;
flowInputs['table_name'] = current.getTableName();
var result = sn_fd.Flow.startAsync('global.alternate_approval', flowInputs);//alternate_approval is a catalog item name
7. For Knowing the execution (sys_flow_context) of flow based on RITM.
Add flow context field (OOB Present no need to create) from Form Layout/Form Design on the RITM(sc_req_item) form.
Add below code in the same run script, it will update the name of flow execution in the flow context field.
//The Sys ID of a flow execution (contextId)
var contextId = result.contextId;
current.flow_context = contextId;
current.update();
8. Add the workflow in the catalog item.
Catalog Item --> Process Engine --> Workflow.
This blog is only for service catalog related execution not for table execution and for table related execution i will post another blog.
Thank You !!!
Regards,
Meghnath
Labels:
https://www.servicenow.com/community/developer-articles/calling-flow-designer-from-workflow-when-using-both-workflow-and/ta-p/2319710
