What updates the Change Request when a Change Task is closed?

tee3
Giga Expert

Hi SN Community,

I'm wondering if anyone knows what triggers an update to the Change Request when a Change Task is closed? We've created a new state for Change Tasks and are noticing that when a task is closed with the new state, the Change Request does not update which causes an issue with "Wait for Condition" activity in the workflow.

Appreciate any help.

1 ACCEPTED SOLUTION

You can do that... it's just another business rule. Something like this:



Name: Force change update


Table: Change task (change_task)


Advanced: true


When: after


Insert: true


Update: true


Condition (blank)


Script:



(function executeRule(current, previous /*null when async*/) {



        var chg = new GlideRecord('change_request');


        if (chg.get(current.change_request)) {


                  chg.setForceUpdate(true);


                  chg.update();


        }



})(current, previous);


View solution in original post

6 REPLIES 6

Chuck Tomasi
Tera Patron

Hi Tee,



The change request can either be typically updated by a business rule or the workflow attached to that record. My preference is a workflow that watches the change tasks get updated and then updates the parent change request accordingly.


Hi Chuck,



Thanks for your reply. My issue is that I don't really need to update anything on the change request other than for the purpose of triggering an update to the workflow so my "Wait for Condition" is triggered.



The scenario is that a change task is marked Closed Failed(New state that we created), this does not trigger an update to the change request which is why my wait for condition that checks whether the tasks are closed or not is never completed even though all my tasks are no longer active. If the change task is marked closed complete, incomplete or skipped, this works just fine. I've also noticed that if my change task is closed failed and I update the change request manually, my workflow progresses as expected. Which is why I'm wondering if there is a system business rule that triggers an update to parent change when a change task is closed complete, incomplete or skipped.


My guess is that your new state is not changing the change task active field to false. If you use the default states, there's a business rule that does this automatically. Change requests have been using state flows for a while on this. The quickest, easiest way to do this is create a simple little business rule on the change task - you don't even need any script -



Condition: State | changes to | Closed Failed


Set field values: Active | false



Done.


As a matter of fact, I already have a business rule to update the active flag which is working as expected.



But, the problem is that the actual change record does not update when this happens which doesn't satisfy my wait for condition and hence my issue. If i save the change record after the task is updated, the workflow moves forward. So, basically I just need to trigger an update to my change record for the condition to satisfy.