- 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
‎01-25-2021 08:04 PM
Hi James.
I wanted to say Thank You for your resolution information. It helped me resolve the populating the REQ and RITM Requested For field with the name on a Requested For form variable (Reference type using sys_user table) that I created for when a user submits a request on behalf of another one.
Thanks again!