Clear a record producer variable based on value of another variable

ronro2
Tera Contributor

Hello Guys! 

In a Record Producer in Servicenow, I want that if the user switches between the choices in a multiple choice variable, that the value in another multiple choice is reset immediately.

So if the user switches to choice "orderer" from either choice "administrator_add_on" or choice "accounting_assistance" in multiple choice variable "delegation_type", then the value in multiple choice "attach_file" shall be set to zero/be empty ('attach_file' has choices yes and no). 

This is my current onChange Catalog Client Script, which is not working:

function onChange(control, oldValue, newValue, isLoading) {

    // Om 'delegation_type' ändras till 'orderer'
    if (control.id === 'delegation_type' && newValue === 'orderer') {
        // Nollställ 'attach_file'
        g_form.clearValue('attach_file', '');
    }

Thankful for your help! 
1 REPLY 1

Abbas_5
Tera Sage
Tera Sage

Hello @ronro2,

Please refer to the below link:
https://www.servicenow.com/community/itsm-forum/clear-a-record-producer-variable-based-on-value-of-a...

 

Mark my correct and helpful, if it is helpful and please hit the thumbs-up button to mark it as the correct solution.
Thanks & Regards,
Abbas Shaik