Is it possible to set default_value from the client script?

Mr world wide
Mega Guru

I create a Custom variable on the Catalog item and Used the widget there like mentioned in this article: https://community.servicenow.com/community?id=community_article&sys_id=659ff21cdb30105013b5fb2439961...

 

One question is it possible to set the same default value data from the client script?

I want to set the dynamic default value.

My default value has encoded query and when the type field changes, the default value should change accordingly.

Ex: My Default value

{
"widget": "table_values",
"title":"Table values",
"maximum_entries": 1,
"table": "custom_table",
"encoded_query": "active=true^ORDERBYorder",
"dropdown_title": "name",
"dropdown_description": "description",
"dropdown_image": "image",
}

Ex: If the Top field (type) changes I want to change the encoded query for that reason I want to set the default value from the catalog client script but no luck.

"encoded_query": "active=true^ORDERBYorder^type=individual",

 

I tried onLoad, and OnChange client scripts with setValue but not working

5 REPLIES 5

i'm trying to do the same thing.  You ever get anywhere with this?