Need to write the client script

PRAGHATIESH S
Tera Expert

If assigned to filled, state should be changed to Open.

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @PRAGHATIESH S 

Could you please provide more detail, what exact is your use case, which table, from where the state should change?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

It is on the case table, if state is new and filling the assigned to field. State set to open.

Sandeep Rajput
Tera Patron
Tera Patron

@PRAGHATIESH S You can take inputs from the following client script if you need to set state field based on assigned to field. An onChange client script on Assigned to field can be created as follows.

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

    //Type appropriate comment here, and begin script below
    // Check if the new value of Impact is different from the old value
    if (newValue != oldValue) {
        // Set the State field to "Open" (value of '1' is for Open state)
        g_form.setValue('state', '1');
    }
}

Hope this helps.