Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

If Script in workflow for finding change variable in catalog item

Dhanu1
Tera Contributor

Hi Team, 

Good morning, 

 

My requirement is we have a variable called " I change" in the catalog item, now the if script is true(yes) when we update the value , when user select an existing application in the catalog item they update other than I change field it will false(no) , can anyone please help me on this.

 

 

Thanks

Dhanu

2 REPLIES 2

Sarthak Kashyap
Kilo Sage

Hi @Dhanu1 ,

I tried your problem in my PDI and it is working fine 

please check below solution

 

Create 2 fields  1. I Change type is Checkbox. 2. Application - type Reference your specific table 

 

Create Catalog client script

Type - OnChange of Application field and add below code 

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

    alert("Here");
    g_form.setValue('i_change', true);

}

SarthakKashyap_0-1761284134207.png

 

Result 

When I didn't change application I change field is false

SarthakKashyap_1-1761284210670.png

 

When I change Application, I change field is true 

SarthakKashyap_2-1761284240539.png

 

Please mark my answer correct and helpful if this works for you

Thanks and Regards,

Sarthak

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@Dhanu1 

you didn't share your code, screenshots.

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader