- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2019 03:32 AM
Hello All,
I am trying to copy a location catalog variable on Request item and request form.
I have written the below code.
I have a run activity on request item workflow which is trying to set the location variable on scratchpad.
Run script activity on workflow.
Then I am running a after business rule on request item table to set the location variable value on request item form and request form’s filed called location.
But this script is not working, I have tried multiple thing but unable to do so.
Can anyone help me over here?
Regards,
Priyanka
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2019 05:23 AM
If I understand it correct you would like to update location field on RITM and Request using the location variable
Try the below script in Run script
//Update location field on RITM
current.location = current.variables.location;
//Update location field on Request
var gr = new GlideRecord("sc_request");
gr.addQuery("sys_id", current.request);
gr.query();
if (gr.next()) {
gr.location = current.variables.location;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2019 11:28 PM
Hi DVP,
thank you, just making one correction in your script.
as location is a reference field, so it is working with setDisplayValye function.
Below script I have used.
//Update location field on RITM
current.setDisplayValue('location', current.variables.location);
//Update location field on Request
var gr = new GlideRecord("sc_request");
gr.addQuery("sys_id", current.request);
gr.query();
if (gr.next()) {
gr.setDisplayValue('location', current.variables.location);
gr.update();
}