Change RITM field when SCTASK field is changed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 09:53 AM
This may seem a little odd, but here we go. I want to create a business rule that does the following.
When the user changes the requested_for filed in the SCTASK then the opened_by filed in the RITM and the REQ are changed to the value that the requested_for was changed to. I'm not very good at writing scripts, I have tried building the logic, but am not having any luck. Any help would be greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 09:57 AM
Hi @RobertPC
May i know use case for this? Once a request submitted, why need to change the user?
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]
****************************************************************************************************************

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2024 10:14 AM - edited 02-02-2024 10:18 AM
@RobertPC Here is how you should configure the business rule.
Here is the script.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.opened_by = current.requested_for+'';//Set Opened by on RITM
var requestRef = current.request.getRefRecord();
requestRef.setValue('opened_by',current.requested_for); //Set Opened by on Request
requestRef.update();
})(current, previous);
Hope this helps.