How to use g_form.save() in client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 07:52 AM
Hello community,
I wanted to use g_form.save() in onLoad catalogue client script for one scenario
Variable data populated from third party integration. But variables unable to read in flow. If we save the RITM form for one more time after immediate data population from integration, flow is able to read the variables.
So that, I wanted to use g_form.save() in onLoad client script. But after using this it went in a loop. I wanted to know is there any best approach to use g_form.save()
Or is there any approach to able to read variables in a flow after variable data populated from third party integration.
Thank you in advance.
Thank you
G Ramana Murthy
ServiceNow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 11:34 PM
Hi @RAMANA MURTHY G ,
Instead of using g_form.save() in the onLoad catalog client script, you can use a GlideAjax call to asynchronously save the form data after the variables are populated from the third-party integration. This will allow the variables to be committed to the database without causing a loop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-08-2023 11:36 PM - edited 12-08-2023 11:48 PM
Helli @Community Alums ,
Thank you for your quick response. Can u suggest any sample code snippet for how to save records without causing a loop using the GlideAjax call?
If we call GlideAjax from the onLoad client script, GlideAjax saves the record, then the form is again loaded, then the onLoad client script again calls GlideAjax. Again it causes a loop.
Thank you
Thank you
G Ramana Murthy
ServiceNow Developer