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

Mike Patel
Tera Sage

you can add below to run script on cat item workflow.

//Set Parent Request Short Description//
var reqParent = current.request.getRefRecord();
reqParent.xxxxxx = current.variables.xxxxx;
reqParent.autoSysFields(false);
reqParent.update();
 

Hi,

workflow table is sc_request and i want set the fields of request form only

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

i think OOTB Workflow is affecting, how can disable OOTB 'Service Catalog Request' for this catalog item and only make custom WF to run