- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2020 09:50 AM
I need a client script for use in an onChange function to remove all rows from a multirow variable set.
Scenario
- A user will select a CI in a catalog item, and add maximum rows to a multirow variable set based on max_rows attribute.
- Then, the user realizes the wrong CI was selected, and changes the selected CI
- Upon selection of a new CI, I need a client script to remove all rows from the multirow variable set and enable the "Add" button.
I have tried the following without success
- g_form.setValue(< mrvs name>, '');
- g_form.setValue(< mrvs name>, '[]');
- g_form.clearValue(< mrvs name>);
In all instances the information is removed, but the "Add" button remains disabled.
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2020 04:23 PM
I got it working guys!
As it is a bit much I have written an article on it:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2020 01:40 PM
okay. can you check browser console and see if you are getting any error there
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2020 01:48 PM
com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=4ba269eb1bd59c501462ececbc4bcb32&sysparm_link_parent=0753dcfe4f8e02400e20650f0310c766&sysparm_catalog=b6d4f9504ffdca000e20650f0310c781&sysparm_catalog_view=catalog_*****_technical:1094 Uncaught TypeError: g_form.getField is not a function
at h_f8a2c4841b5b14101462ececbc4bcbf0 (com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=4ba269eb1bd59c501462ececbc4bcb32&sysparm_link_parent=0753dcfe4f8e02400e20650f0310c766&sysparm_catalog=b6d4f9504ffdca000e20650f0310c781&sysparm_catalog_view=catalog_*****_technical:1094)
at doCatOnChange (js_includes_catalog.jsx?v=08-05-2020_0901&lp=Wed_Sep_09_08_36_25_PDT_2020&c=13_457:616)
at variableOnChange (js_includes_catalog.jsx?v=08-05-2020_0901&lp=Wed_Sep_09_08_36_25_PDT_2020&c=13_457:554)
at HTMLInputElement.onchange (com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=4ba269eb1bd59c501462ececbc4bcb32&sysparm_link_parent=0753dcfe4f8e02400e20650f0310c766&sysparm_catalog=b6d4f9504ffdca000e20650f0310c781&sysparm_catalog_view=catalog_*****_technical:525)
at callOnChange (js_includes_last_doctype.jsx?v=08-05-2020_0901&lp=Wed_Sep_09_08_36_25_PDT_2020&c=13_457:6222)
at e.referenceSelect (js_includes_doctype.jsx?v=08-05-2020_0901&lp=Wed_Sep_09_08_36_25_PDT_2020&c=13_457:22415)
at e.select (js_includes_doctype.jsx?v=08-05-2020_0901&lp=Wed_Sep_09_08_36_25_PDT_2020&c=13_457:22389)
at e.onMouseUp (js_includes_doctype.jsx?v=08-05-2020_0901&lp=Wed_Sep_09_08_36_25_PDT_2020&c=13_457:22476)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2020 10:40 PM
Okay. Check out the article of Willem.
Mark my comment(s) as helpful if they had helped you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2020 01:48 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-11-2020 01:54 PM
Don't know that I have already mentioned this, but I have also tried the following.
Where 'b919a58b1b32dc10c1ff4159cc4bcbb4Add' is the element ID of the Add button.
g_form.setValue('variables.capacity_request_cpu', '[]');
g_form.setDisabled('b919a58b1b32dc10c1ff4159cc4bcbb4Add', false);