Change CTASK status when Change Request state changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2017 11:37 AM
Hi, my requirement is put the CTASKs in Pending state until the CR moves to waiting for deploy. Once CR is in waiting for deploy, CTASK should be in OPEN state. I have modified the subflow of CTASKS to be in pending when they are opened, but can't figure out how to do the rest.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2017 11:43 AM
Hello Vishnu,
You can have a BEFORE business rule on change task and update the status based on change request table. Also an After business rule on change request table to update related change task depending on the conditions you have mentioned.
Please let me know if you have any questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2017 12:47 PM
Pradeep, can you help me with the script? Just a rough plot

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2017 01:21 PM
CHANGE TASK TABLE:
chg= new GlideRecord('change_request');
chg.addQuery('sys_id',current.parent);
if(!chg.hasNext()){
if(chg.state == '' ||chg.state == '' ){ //Change state Value
current.state = 4; //Task state value
}
if(chg.state == '' ||chg.state == '' ){ //Change state Value
current.state = 4; //Task state value
}
}
CHNAGE TABLE:
chg= new GlideRecord('change_task');
chg.addQuery('parent',current.sys_id);
if(!chg.hasNext()){
if(current.state == '' ||current.state == '' ){ //Change state Value
chg.state = 4; //Task state value
}
if(current.state == '' ||current.state == '' ){ //Change state Value
chg.state = 4; //Task state value
}
chg.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-06-2017 01:41 PM
Hello Vishnu,
Sample script below to be created on Change Request table(AFTER BR).
var gr = new GlideRecord('change_task');
gr.addQuery('change_request',current.sys_id);
gr.query();
if(gr.next()){
if(current.state = 'PASS CHOICE VALUE OF WAITING FOR DEPLOY')
{
gr.state = '1';
}
if(current.state = 'PASS CHOCIE VALUE OF STATE FOR WHICH YOU NEED CHANGE TASK TO BE PENDING')
{
gr.state = "UPDATE CHOICE VALUE OF CHANGE TASK HERE I.E PENDING";
}
}
gr.update();