Need to populate message on change form upto resolved state

MK21
Tera Contributor

Hi All,

 

I have a requirement in the change request form, whenever a change request is opened in the respective state you need to populate the Mess in Please fill in assign on how to achieve this can anyone provide the script or any method

 

example if I open the schedule state change it will display the Please fill the assigned to 

 

Please help to achieve this .

6 REPLIES 6

Maddysunil
Kilo Sage

@MK21 

Ideally you should make assigned to field mandatory on state change but if you dont want to make it mandatory, you can write before/after business rule to show the message:

 

(function executeRule(current, previous /*null when async*/) {
    // Get the current state of the Change Request
    var state = current.state;

    // Define messages for different states
    var message = '';
    switch (state) {
        case 'schedule':
            message = 'Please fill in the assigned to';
            break;
        // Add cases for other states as needed
        default:
            // Default message if state doesn't match any specific case
            message = 'Default message';
    }

    // Set the "Message" field with the appropriate message
    current.message = message;
})(current, previous);

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

Harish KM
Kilo Patron
Kilo Patron

Hi @MK21 you need to educate client rather then popping up alert on each state change with script it is better to make the assigned to field mandatory which will put the alert similar way, this way you don't need a custom client script for this to check. 

 

 

Regards
Harish