when state change in progress and state change in on hold then on hold reason should be added

sangitakumari
Tera Contributor

Hi Team,

I have a requirement like when state change in progress and state change is on hold then on hold reason will be added in work notes and also when state is in progress then it also added in work notes. and also want to print in state value name and on hold value name. If anyone know Please let us know .

6 REPLIES 6

Robbie
Kilo Patron
Kilo Patron

Hi @sangitakumari,

 

Standard configuration out of the box provides this functionality - when the 'On hold' checkbox is set to true, the On Hold reason is mandatory. When saved, this comment is added to the work notes.

 

Can you check the Client Scripts and ensure the Out Of Box Client Script: Change Model: read only state On hold is active

 

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


Thanks, Robbie

i checked when i saved on hold reason in comment is not added to the work notes. I try it through business rule as well.

 

sangitakumari_0-1719313131328.png

 

if (current.state.toString() == '2') {
        current.work_notes = "State changed to" + current.getDisplayValue('state');
    } else if (current.state == '3') {
        if (current.hold_reason.toString() == '3' && current.hold_reason.toString() == '4' && current.hold_reason.toString() == '5') {
            current.work_notes = "State changed to" + current.getDisplayValue('state') + "and reason is" + current.getDispalyValue('hold_reason');
            gs.log("work_notes chnage for state" + current.work_notes);
        }
    }
 
when i changed the state is in progress then it added in work notes when i  updated short description in work notes its added again state is in progress. but for on hold reason its not working on hold reason is not added in work notes.

@sangitakumari ,

 

try giving || (or) condition for on hold reason i have modified the code please give it a try,

 

if (current.state.toString() == '2') {
        current.work_notes = "State changed to" + current.getDisplayValue('state');
    } else if (current.state == '3') {
        if (current.hold_reason == '3' || current.hold_reason == '4' || current.hold_reason == '5') {
            current.work_notes = "State changed to" + current.getDisplayValue('state') + "and reason is" + current.getDispalyValue('hold_reason');
            gs.log("work_notes chnage for state" + current.work_notes);
        }
    }

 

 

Please check and Mark Helpful and Correct if it really helps you.

Regards,

Swathi Sarang

sangitakumari_0-1719314402495.png

 

sangitakumari_1-1719314425364.png

 

on hold reason is poupluating un define. when i am updating short description then work notes updated automatically.