Calling a server-side script in confirm pop-up box

Richard Tamparo
Mega Guru

I am trying to display a message depending on the user's current language settings.

I tried the code in line 2 in the background script and it worked BUT it doesn't work when I placed it before the "confirm code" in line 11.

 

If I'm going to comment on line 2, the pop-up works fine. Is there another way where I can get the user's language setting and display the appropriate message based on the set language? 

 

RichardTamparo_0-1670485201820.png

 

1 ACCEPTED SOLUTION

RaghavSh
Kilo Patron

gs.getUser().getlanguage() is a server side code, so it is working in background script.

In UI action you are using it in client side, so it will not work and throw an error. (Anything written in function in UI action is considered a client code).

 

Since you want this code in client only, the solution here is to move the server side code (gs.getUser().getlanguage()) to a client callable script include and call it via GlideAjax then it should work.


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023

View solution in original post

1 REPLY 1

RaghavSh
Kilo Patron

gs.getUser().getlanguage() is a server side code, so it is working in background script.

In UI action you are using it in client side, so it will not work and throw an error. (Anything written in function in UI action is considered a client code).

 

Since you want this code in client only, the solution here is to move the server side code (gs.getUser().getlanguage()) to a client callable script include and call it via GlideAjax then it should work.


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023