- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 06:10 PM
Requested_For Variables Request/Requested Item
HI Community!
Need some advise and a little help. In Fuji release I am trying to sync the REQ & RITM requested_for variable from a variable set and for some reason its not working - Any ideas, Help is appreciated.
Issue: The 'requested for' on both the request and the requested item, does not populate from the variable set "requested for". Please see below.
Requirement: requested for on both the item and request level to populate from the variable set, as many people open on behalf of other users.
Screen Shot
Below is a mock version of proposed script - just not sure if this is best approach?
var req = new GlideRecord('sc_request');
req.addQuery('sys_id', current.request); // find the REQ record
req.query();
// if REQ record found then set value
if (req.next()){
req.requested_for = current.variables.requested_for;
req.update();
}
Thanks for any help.
James
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2016 06:09 PM
Hey Community.
UPDATE - SOLVED
I guess all I needed was some sleep!!
Here is what will do the trick.
1. Open the workflow attached to request
2. Check it Out
3. Add the script below in the workflow after "Begin" as a run script activity.
4. NOTE - The requested_for field is actually on the sc_request not the sc_req_item.
var req = new GlideRecord('sc_request');
req.addQuery('sys_id', current.request); // find the REQ record
req.query();
// if REQ record found then set value
if (req.next()){
req.requested_for = current.variables.requested_for;
req.update();
Regards,
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2016 06:09 PM
Hey Community.
UPDATE - SOLVED
I guess all I needed was some sleep!!
Here is what will do the trick.
1. Open the workflow attached to request
2. Check it Out
3. Add the script below in the workflow after "Begin" as a run script activity.
4. NOTE - The requested_for field is actually on the sc_request not the sc_req_item.
var req = new GlideRecord('sc_request');
req.addQuery('sys_id', current.request); // find the REQ record
req.query();
// if REQ record found then set value
if (req.next()){
req.requested_for = current.variables.requested_for;
req.update();
Regards,
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-09-2022 09:42 AM
Very helpful!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2019 03:07 AM
You had the exact same problem as myself, and your solution worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2019 11:10 AM
Excellent! Happy it helped!