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 07:04 AM
Hi @Lkowalski
If there are more than 1 task on same RITM then how it work?
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 07:06 AM
Yes, one SCTASK on same RITM.
For example If SCTASK state = Pending, then RITM state should change automatically to State = Pending
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2024 07:22 AM
For this you need to add condition or create a BR mate.
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 07:45 AM
I create a BR. You can see it in my post but it does not works.