Is it possible to set default_value from the client script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2022 01:50 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2022 05:59 AM
i'm trying to do the same thing. You ever get anywhere with this?