Urgent:Business rule to check change task close code value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 03:16 AM
Hi,
I am writing after business rule on change request table to check close code value of change task.
My requirement is: if close code of changetask is successful/successful with issues -> change req state should move to review
if close code of changetask is unsuccessful ->change request state should be in implement only.
Below is my BR. Please correct me if i am doing anything wrong here..
Thanks
Soumya
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 04:21 AM
You're missing a few standard GlideRecord lines after var gr to locate and return the change task record before you get any values from it...
var gr = new GlideRecord('change_task');
gr.addQuery('change_request', current.sys_id);
gr.addQuery('active', false);
gr.query();
while (gr.next()) {
var cc = ........
Also, since you are running the BR after Update, you need a current.update(); line in the if and else. Another approach that would work in this case is to change the BR to run before Update, then do not include the current.update lines. Also in this case since the BR only triggers when the Change Request State changes to Implement, you don't need to set the current state to Implement, so as written your if block would be empty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 04:41 AM
Thankyou for ur response. I tried but it didnt work
even if close code is unsuccessful change req is moving to review..
Any other way to achieve this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 05:12 AM
You didn't mentioned "current.state = " in unscceussful code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2022 05:22 AM
if i do also no difference..its not working