Unable to set/clear value of a variable with "onChange" client script - "control" object - within a multi row variableset

Community Alums
Not applicable

Hi,

I am unable to set/clear value of a variable with "onChange" client script - "control" object -  within a multi row variableset. Is it a known issue Or anything wrong with my code or PDI?

 

See below code and attached screenshot.

 

 

g_form.setValue('u_age',''); // working

g_form.setValue(control,''); // not working

g_form.clearValue(control); // not working

 

12 REPLIES 12

Community Alums
Not applicable

Hi,

Thanks for reply but I don't agree that we cannot use control for setting/clearing value. Any thread or documentation for same?

Though I have learned now that control is not accessible in portal so this could be a good reason in my case for not using it in client script. 

https://docs.servicenow.com/bundle/orlando-application-development/page/script/client-scripts/concep...

Hi, 

Check this thread: https://community.servicenow.com/community?id=community_question&sys_id=69a7acbbdb91a3809540e15b8a96...

Also in doc says that control it's not supported in Service Portal.

If it was helpful, please give positive feedback.

Thanks, 

If it was helpful, please give positive feedback! ✔
☆ Community Rising Star 22, 23 & 24 ☆

asifnoor
Kilo Patron

Hi,

What is control that you are using here?

you need to mention the field names that you want to clear, like you are doing for u_age.

Kindly mark the comment as a correct answer and helpful if it helps to solve your problem.

Regards,
Asif
2020 ServiceNow Community MVP

Hemant Goldar
Mega Sage
Mega Sage

Hi,

Control object will give you HTML object for that field so that you can change or use it as per your need for example If we wants to change the dynamically field size, length etc in ui page .

 You cannot use Control Object to g_form.setValue() and g_form_clearValue().

 

Please mark reply as Helpful/Correct, if applicable.

Kind Regards,

Hemant

Community Alums
Not applicable

I don't agree that we cannot use control for setting/clearing value. Any thread or documentation for same?