- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 07:44 AM
Hi everyone,
Can someone please help me with where the issue is while parsing the variable data? we need to show data in variable
Created a script include from which to get third-party data and show it in the catalog variable.
{"result":{"catalog_item":"3a25637b47701100ba13a5554ee490a0","variable_name":"locationdata","choices":[{"label":"mumbai","value":"3"},{"label":"delhi","value":"2"},{"label":"Passing","value":"1"}]}}
script include:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 10:10 AM
You need to store that data as choices on the variable, or use a remote table if you need both the value and label continuously

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 09:04 AM
Hi,
When you return data via GlideAjax, you need to return it as a string rather than a parsed object.
return responseBody
or
return JSON.stringify(responseBody)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 09:24 AM
Hi Kieran,
Thanks, I can see now response is coming on client side, and now the options are showing undefined on alert.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 08:56 AM
Does the following line produce a value with the expected data?
alert('Parsed Data: ' + JSON.stringify(data)); produce a value?
You would need to use JSON.parse(data) to turn that into an accessible object.
You also don't need to do the following, that is if you were writing html option elements, but the g_form API does this for you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2025 11:33 PM
Yes, the alert alert ('Parsed Data: ' + JSON.stringify(data)) producing a value and can see the data is coming successfully, but after adding array the to add label and value which is not working, and data is not showing on alert (!data.result).