How to convert Workflow Script To Flow desihner

MalikB
Tera Contributor

Hi! 

 

In a case of a conversion from workflow to flow designer , in the first step there is a Script to set RITM fields :

current.short_description = current.variables.ritm_short_description.getDisplayValue();
var related_offering = new GlideRecord('u_m2m_service_offering_catalog_item');
related_offering.addQuery('u_catalog_item', current.cat_item);
related_offering.query();
if (related_offering.next()) {
    current.service_offering = related_offering.getValue('u_service_offering');
    var service_offering = related_offering.u_service_offering.getRefRecord();
    current.assignment_group = service_offering.getValue('u_support_level_n1');
    current.business_service = service_offering.getValue('parent');
}

 And in the Catalog Task :

task.assignment_group = current.variables.sctask_assignment_group.getValue();
task.short_description = current.variables.sctask_short_description.getDisplayValue();

How to convert the workflow (begin -> Run Script (set RITM fields) -> Approval Action -> Catalog Task -> X=Set values -> end) to a flow designer? 

8 REPLIES 8

JenniferRah
Mega Sage

This is kind of a trick question, because you wouldn't do it the same way in a Flow. 

 

You would first need to do a "Get Catalog Variables" action to get access to all the catalog variables.

You would then have to do a "Get Record" action to get the related offering record.

Then you would do an "Update Record" action to update the short description, assignment group, and business service. You would use the drag/drop interface to set them from the data pulled above. 

Viraj Hudlikar
Giga Sage

Hello @MalikB 

 

You will need to have a flow which will have trigger type as ServiceCatalog.

Then first use Get Catalog Variable action select Catalog Item name and variables you need across flow.

Now before update as per your script you need a LookUp record action on table as specified and get those output record and use in next step. 

Now since you want to update RITM field values so you will use Update Record Action then after that you need approvals so you will use Ask for Approval action and you have to pass user or group what is needed as per requirement.

Now on approval result it will be catalog task creation so you will use Create record action and in table option select sc_task once task is created you will set values of task created by using Update Record action.

 

Some videos of Flow Designer:

https://youtu.be/qeSumpq0KVM?si=hAGjgB4APjgFRoHu

https://youtu.be/_HieT-wwVL0?si=_XPpZkVkDnybt1xr

 

If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.

 

Thanks & Regards
Viraj Hudlikar.

Ankur Bawiskar
Tera Patron
Tera Patron

@MalikB 

Steps

1) use Get Catalog Variables Flow Action

2) Then use Lookup on "u_m2m_service_offering_catalog_item" with your condition

3) Then use Update Record flow action and update your RITM with the field values from previous step

4) During your Create Catalog Task set the fields Assignment Group= Get Catalog Variable->VariableName and similar thing for Short Description

Once you start you will be in a comfortable position.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@MalikB 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader