Populate value of sc_req_item item from Catalog variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2019 11:44 AM
Is there a script where I can take the value that user enters in Requested Item variable and populate that value in a sc_req_item field
Thanks
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2019 11:50 AM
Hi there,
Could you explain your question a bit more? Is it like a submitted variable, you would like to "map" or see in a field on a record in the platform UI? Or are you after something else?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2019 12:00 PM
Hey Mark
Yes to the former. Customer has an option to select which 'assignment group' they want the item to be assigned to. Then I would like whichever group is selected to populate the 'assignment_group' field in sc-req_item. Hope that makes sense.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2019 12:14 PM
Clear. I assume you have a workflow attached to the RITM, is that correct? In that case, you could enrich the generated RITM thru a Run Script activity.
Maybe a timing issue could occur [the RITM has to be saved before you can access the RITM and the variables], but a 1 second timer would fix this.
In the scripting, you can use:
current.assignment_group = current.variables.your_variable; [assuming your field is a reference field!]
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2019 11:59 AM
As I understand you description, you want to take a variable value (Which users enter during the submission of catalog item) and put it in one of the fields which is present of the request item form.
Write a BR on SC_REQ_ITEM table based on your requirement // If you inform the scenario like when exactly you want to get and put the variable value in a field, I will inform you what exact condition (Before/After) you need to user. Then use the below script.
var ritm = new GlideRecord(sc_req_item);
ritm.addQuery('sys_id',current.sys_id);
ritm.query();
if(ritm.next()){
var xyz = ritm.variables.<Variable database value>.
current.shortdescription = xyz // currently I am setting variable value in short description. You can modify as per your requirement.
ritm.update();
}