Populate the requested for catalog item variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2023 11:36 PM
Hello Community,
I would like assistance with populating the request.requested_for field using the custom variable named requested_for.
In the catalog item, we have created a custom variable named requested_for. When we submit the request, the "requested for" is correctly set in both the request and the RITM.
Now, we want to display the value of the requested_for in our custom variable.
Please refer to the below screen shot.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 02:26 AM
you can directly use Update Record action and set the field value
Table - sc_request
Field:
Requested For ->
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 04:50 AM
We have checked using the above step but it still its not working. We check request level Flows, BR, Scripts also.
Is it good way to write BR in RITM table?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 05:18 AM
It should work ideally using Flow. please share step screenshot
OR
you can use after insert BR on RITM table
Condition: current.cat_item.name == 'Your Catalog Item Name Here'
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var req = current.request.getRefRecord();
req.requested_for = current.variables.requested_for;
req.update();
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2023 01:02 AM
Hi @Aditya37
As suggested by expert @Ankur Bawiskar OOTB requested for set as logged in user and in case you want to populate the custom requested for, you need to write the code.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************