How to set 'close code' choice field when change request form's state changes to cancelled?

Nitin21
Tera Contributor

How to set 'close code' choice field in change request form to 'Cancelled' when the state of change request changes to 'Cancelled' ?

2 ACCEPTED SOLUTIONS

Try below code in script section.

 

(function executeRule(current, previous /*null when async*/) {
current.close_code="successful_issues"; // Change the value of close code
current.update();
   
})(current, previous);
 
 
Thanks.

View solution in original post

Robbie
Kilo Patron
Kilo Patron

Hi @Nitin21,

 

Do you want the Close Code to be set by the system in an automated fashion with the same value every time such as the value of 'Cancelled' for example (depending on what codes have been implemented on your system) or do you want this to be selectable by the user when the Change is Cancelled?

 

There are various ways to solve this each differing in complexity, however, my recommendation would be to automate this and have a simple Business Rule set this for you. The State change and Cancellation reason is captured as part of the baseline configuration so the Business Rule option outline below should provide a suitable solution.

 

See the below screenshots for a low-code/no-code option.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

 

(When to run Tab)

Screenshot 2024-03-13 at 10.13.05.png

(Actions Tab)

Screenshot 2024-03-13 at 10.13.16.png

View solution in original post

7 REPLIES 7

Nitin21_0-1710324608323.png

Nitin21_1-1710324650422.png

this is what i did in my personal instance.

Robbie
Kilo Patron
Kilo Patron

Hi @Nitin21,

 

Do you want the Close Code to be set by the system in an automated fashion with the same value every time such as the value of 'Cancelled' for example (depending on what codes have been implemented on your system) or do you want this to be selectable by the user when the Change is Cancelled?

 

There are various ways to solve this each differing in complexity, however, my recommendation would be to automate this and have a simple Business Rule set this for you. The State change and Cancellation reason is captured as part of the baseline configuration so the Business Rule option outline below should provide a suitable solution.

 

See the below screenshots for a low-code/no-code option.

 

To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Helpful.

 

Thanks, Robbie

 

(When to run Tab)

Screenshot 2024-03-13 at 10.13.05.png

(Actions Tab)

Screenshot 2024-03-13 at 10.13.16.png

Nitin21
Tera Contributor

Thank you! this works too.