how to clear fields when I change the state

akshayjain
Tera Expert

I have created a custom field  on on hold state. Now when state is on hold, the field is filled. When state changes to work in progress, those fields have stored values, again when i m putting state to  on hold  those values are  not  clear.

1 ACCEPTED SOLUTION

Kamal17
Kilo Sage

Hi Akshay,

Write an on-Change client script for the field 'State'

you can add below logic to clean the custom field value inside the onchange script

if(newValue == 'on hold'){

g_form.setValue('custom_field_name','');// you can also use clearValue(fieldname) function instead of setValue()

}

Mark Correct if this solves your issue. Hit Like/Helpful based on the impact.

Regards,

Udhay

View solution in original post

3 REPLIES 3

Omkar Mone
Mega Sage

Hi 

You can write a onChange client script and write this code:-

g_form.setValue("your_state", "");

 

Mark correct if it helps.

 

Regards,

Omkar Mone

www.dxsherpa.com

Kamal17
Kilo Sage

Hi Akshay,

Write an on-Change client script for the field 'State'

you can add below logic to clean the custom field value inside the onchange script

if(newValue == 'on hold'){

g_form.setValue('custom_field_name','');// you can also use clearValue(fieldname) function instead of setValue()

}

Mark Correct if this solves your issue. Hit Like/Helpful based on the impact.

Regards,

Udhay

Danny Sun
Tera Guru

Hi Akshay,

 

Create a UI Policy with the condition: state is not hold, check the Run scripts and add the follow script to the Execute if true:

function onCondition() {

    g_form.setValue('custom_field_name','');

}

 

Regards,

Danny