OnSubmit catalog client script not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 02:29 PM
Hi All,
I am working in requirement that one variable should populate based on different conditions(Like location,BU and country ect ) depends on catalog form.
I have written script included and OnSubmit catalog client script, Here I am getting logs and alerts correctly. But same value not populating in variable.
Note: This variable calling from variable set.
can anyone help me on this ,Tanks in advance.
Thanks,
Krithvik.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 02:44 PM
Hi Krithvik,
Can you share more information on this? Add a screenshot of your item for example. Can you share the scripts? Your title says onSubmit, but description onChange.
If it is onSubmit where you are having issues, have a look at this article:
In short, you need either synchronous getXMLWait ajax call or the alternative provided in the article.
This variable calling from variable set.
Is the Catalog client script also on the variable set? Is it a Multi Row Variable Set?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2020 04:07 PM
It's not possible to populate a variable in the main form from a client script in a mrvs. Also, there's no onChange on a mrvs. Unfortunately, GlideAjax is asynchronous so using it in onSubmit will result in the form being submitted before value from GlideAjax is returned to the client script.
It is, however, possible to fetch values in the mrvs from the client script in the main form. Redesign the form so there is no GlideAjax call in onSubmit. For example, having a hidden field in mrvs that is populate by GlideAjax call within mrvs do onSubmit in the main form will be able to validate on the hidden field value in the mrvs.
Check Harshvardhan's response in the following thread on accessing variables in mrvs. Basically, it's just doing a JSON.parse('<mrvs name>') and looping through the rows.