
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2020 08:41 PM
Hi guys,
I have created a catalog item. So once i submit the item, i want to populate Requested for field on Request with the User field in the catalog item. How can i do that? I mean how to map catalog item fields to its Request fields?
Regards,
Indup
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2020 09:43 PM
Hi Indup,
There are two ways to do it.
One is if you have a workflow then after the Begin acitivty add a Runscript acitvity and paste the code there:
ar req = new GlideRecord('sc_request');
req.addQuery('sys_id',current.request);
req.query();
if(req.next()){
req.requested_for = current.variables.user; //current.variables.user is to read the user name from catalog form. same like opend, you can pick other variable value.
req.update();
}
Second way:
Create a after insert BR and copy the code there:
business ruel -- when -- After
Insert - true
Conditoin : - Item is your catalog item
script:
ar req = new GlideRecord('sc_request');
req.addQuery('sys_id',current.request);
req.query();
if(req.next()){
req.requested_for = current.variables.user; //current.variables.user is to read the user name from catalog form. same like opend, you can pick other variable value.
req.update();
}
Note: Replace the user with the user variable in your catalog item
Mark helpful and correct if it helps.
Thank,s
CB

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2020 10:00 PM
Thank you CB,
I am able to achieve it now.
Regards,
Indup