- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2021 11:54 PM
Hello experts!
I have a UI Action which has both client and server side codes..
The client side calls a script include using GlideAjax and fetches 3 arrays from script include, which will be displayed in a 'confirm' dialog box on client. On click of Ok, server side script of UI Action is called.
Now, I need to perform server side actions on those 3 arrays. My question is, how do I pass those 3 arrays from client side of UI action to server side of same UI action...?
I am stuck at this point.. please help..
thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2021 12:24 AM
Hi,
I would suggest this
1) Perform another GlideAjax once confirm box is clicked and send those 3 arrays to another script include function and do the processing
Then no need of server side in that UI action
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2021 12:24 AM
Hi,
I would suggest this
1) Perform another GlideAjax once confirm box is clicked and send those 3 arrays to another script include function and do the processing
Then no need of server side in that UI action
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2021 12:31 AM
If you still want to keep client + server then do this
1) When you are doing the Ajax call and it is returning those 3 arrays
2) in that script include function set the session data using this
gs.getSession().putClientData('myFirstArray', array1);
gs.getSession().putClientData('mySecondArray', array2);
gs.getSession().putClientData('myThirdArray', array3);
3) now in the Server Side of the UI Action get the session data like this
var array1 = gs.getSession().getClientData('myFirstArray');
var array2 = gs.getSession().getClientData('mySecondArray');
var array3 = gs.getSession().getClientData('myThirdArray');
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2021 05:48 AM
Hi.. I am not sure if this would work or not since I went ahead with creating another script include function as per your pervious suggestion and it worked fine..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-20-2021 05:46 AM
I followed this approach and it worked fine... thanks for the suggestion.. 🙂