Map Catalog item variables to request fields using run script in custom workflow

Imatiaz
Kilo Contributor

I have created three variable Requested for, location, description.

now  I need to map these variables to request fields using Run script. or any other recommended way for mapping.

Thanks

 

@Ankur Bawiskar @Pradeep Sharma 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Please use this script in your workflow of catalog item

var req = new GlideRecord('sc_request');

req.get(current.request);

req.requested_for = current.variables.requested_for;

req.location = current.variables.location;

req.description = current.variables.description;

req.update();

Regards
Ankur

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

View solution in original post

8 REPLIES 8

Hi,

It is recommended to have only 1 workflow on sc_request table

This is OOB Service Catalog Request.

If you disable it this will impact your entire platform.

Ideally you should have workflows on your catalog item and not Request table

Regards
Ankur

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

Hi,

It is not working not mapping any value on request form.

Hi,

Is your workflow on catalog item i.e. sc_req_item then the above should work provided you are using valid variable names and valid field names on REQ

Regards
Ankur

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

Hi Ankur,

Above code is not setting the location.