set u_pending_reason value

Sylvain12
Tera Contributor

Hi Everyone,

 

I am trying to modify the value of Pending Reason field (u_pending_reason) in a task in an OnChange Client Script.

I use below code:

g_form.setValue('state', '-5'); // set "state" field to "Pending"
g_form.setValue('u_pending_reason', 'Waiting user information');

 'Waiting User information' is the fist choice of standards value of this field.

However, after applying the script, the field is updated with a new value 'Waiting user information' instead of the standard one:

Sylvain12_0-1697641538990.png

I also tried using numbers to change the value (like for the 'state' field), but it does not work:

Sylvain12_1-1697641666502.png

 

 

Does someone knows how to update this field with a standard value ? 

 

Thank you very much in advance for your support !

 

Sylvain

 

1 ACCEPTED SOLUTION

jMarshal
Mega Sage
Mega Sage

This would depend on how you have the custom variable "u_pending_reason" configured...if you have a label and value mismatch (like the state field), you'll want to set the value without quotes.

You can also try an intermediate variable:


var reason = 'Waiting user information';
g_form.setValue('state', '-5'); // set "state" field to "Pending"
g_form.setValue('u_pending_reason', reason); <--notice, no quotes on "reason"...

 

...if this doesn't help, please post a screenshot of your choice list on the custom variable with value and label.

View solution in original post

2 REPLIES 2

jMarshal
Mega Sage
Mega Sage

This would depend on how you have the custom variable "u_pending_reason" configured...if you have a label and value mismatch (like the state field), you'll want to set the value without quotes.

You can also try an intermediate variable:


var reason = 'Waiting user information';
g_form.setValue('state', '-5'); // set "state" field to "Pending"
g_form.setValue('u_pending_reason', reason); <--notice, no quotes on "reason"...

 

...if this doesn't help, please post a screenshot of your choice list on the custom variable with value and label.

Thank you for your prompt reply !

I checked in variable configuration and indeed the value is "waiting_user_information"...

 

Thank you very much for your support! 

 

Kr,