Pass data from client side of UI Action to Server side script of same UI Action

Servicenow Use4
Kilo Guru

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!

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Sachin Rai
Giga Contributor

Hello,

 

You can pass the value from Client side UI action to Server Side UI action scripts the same way we do it normally while passing values from Client Side Scripts to Server Side Scripts i.e., using "Script Include", and invoking "GlideAjax" in the Client side UI Script.

Please follow the below steps :

1. Create a Script include.

2. Call that script include in Client Side UI script and pass the client side values to it.

3. Invoke this script include in the Server Side UI script and retrieve the values passed on from the client side.

 

Hope my answer helped you, if it did please mark it correct/helpful.

Cheers and Stay Safe!!!