- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2016 12:02 AM
We have a client script which removes few options from a select box variable.
This used to work perfectly fine on my catalog item.
But today I exposed it to run on my fulfilment task form, and the same script is not working.
How do I make g_form.removeOption() work? If this will not work, how do I remove options from my select box.
Thanks
Manish
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2016 12:03 AM
Hi Manish
g_form.removeOption() is not a supported API for variables on Task Records.
Please refer to the documentation on the supported APIs
Client script access to variable fields on task records
For g_form APIs which you don't find working for Task Records, please use g_sc_form.
So g_sc_form.removeOption() would work. But you have the same CatalogClientScript which applies to catalog item and catalog task, have a check on g_sc_form.
Here is the code for the same
if (g_sc_form) {
g_sc_form.removeOption()
}
else {
g_form.removeOption()
}
Thanks
Shouvik
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2016 12:03 AM
Hi Manish
g_form.removeOption() is not a supported API for variables on Task Records.
Please refer to the documentation on the supported APIs
Client script access to variable fields on task records
For g_form APIs which you don't find working for Task Records, please use g_sc_form.
So g_sc_form.removeOption() would work. But you have the same CatalogClientScript which applies to catalog item and catalog task, have a check on g_sc_form.
Here is the code for the same
if (g_sc_form) {
g_sc_form.removeOption()
}
else {
g_form.removeOption()
}
Thanks
Shouvik
PS: Hit like, Helpful or Correct depending on the impact of the response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2016 12:10 AM
Nice. I haven't seen this before. Good to know.
I can't find any use of it in my instance, but I did find this: ServiceNow KB: The g_form.getControl method does not work after ordering (KB0547171)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2016 12:05 AM
Can you post the code? It's hard to debug from our imaginations.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-10-2016 12:07 AM