
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 08:27 AM
I need to change/set the requested_for field in a Requested Item so the Tasks emails contain the proper information.
I've made a script and placed it in both a Run Script as well as the Advanced tab for an SC_Task in a workflow.
I used the following script which appears to work (the log shows the right information), but the form still has the wrong user name:
current.requested_for = current.variables.Request_for_User;
current.requested_by = current.variables.Request_for_User;
current.update();
gs.log("FIRST RUN SCRIPT: Current Number/request_for/requested_by:" +current.number+'/'+current.requested_for.getDisplayValue()+'/'+current.requested_by.getDisplayValue());
Any suggestions?
Mike
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2018 09:03 AM
As it's on the request table you can try
var req = new GlideRecord('sc_request');
req.get(current.request);
req.requested_for = current.variables.requested_for_user; // or whatever the variable is called
req.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2018 09:53 AM
If there a way to place an If statement in this - to differentiate between an Incident Ticket and a Request?
Or
Should I just make a different Notification Template & script for the two of them?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-30-2020 02:50 PM
Can you provide a link to documentation on current? I am trying to learn how its functionality works. There is a script I am working with that uses current.request.requested_for to reference something that is retrieved from a new instance of GlideRecord().