How to achieve if SCTASK state = Pending, then RITM state = Pending
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 07:02 AM
Hello All,
I am trying to create a Business rule which will achieve below:
if SCTASK state = Pending, then RITM state = Pending
if SCTASK state = Work in progress, then RITM state = Work in progress
if SCTASK state = Awaiting User Info, then RITM state = Awaiting Customer
I had created a below BR:
SCRIPT:
I am trying to below script create a code for condition: if SCTASK state = Pending, then RITM state = Pending
(function executeRule(current, previous /*null when async*/ ) {
var ritm = new GlideRecord('sc_req_item');
if (ritm.get(current.request_item)) {
if (ritm.state != '1') {
ritm.setValue('state', 1);
ritm.update();
}
}
})(current, previous);
Thank you for every answer :).
Regards,
Lukas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 08:39 AM
any thoughts.
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 01:20 AM
Try
in single quote
setValue('state', 'closed_value');
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-01-2024 10:51 AM
@Dr Atul G- LNG any thougts how to change my script to make it work ?