How to reload the form when server side conditions are met on Server side script on widget

Chaiatnya
Tera Contributor

Hello,

I've a requirement, when user language is not one of the languages for the service portal list, then user language to be set to English and it should reload the portal page.

I've configured to update the user language in server script but stuck how to reload the form (how to call client script from server script to reload the form). Can some one help

1 ACCEPTED SOLUTION

palanikumar
Giga Sage
Giga Sage

Hi,

You can't do browser refresh from Server Script. If you are trying this for a widget then try this

In server script add this line if you need refresh the page (inside the if block where you are changing the language)

data.refresh = 'true';

 

In client script add this line to refresh the browser after if sees the flag

if(c.data.refresh == 'true'){
location.reload();
}

 

Note: If the refresh flag is not handled properly then it could lead to infinite refresh. Make sure your logic is proper.

Thank you,

Palani

Thank you,
Palani

View solution in original post

7 REPLIES 7

@palanikumar Hi, First solution worked, I made some changes in the code and it fixed. Thanks for your help

shloke04
Kilo Patron

Did you try what I have suggested above?

Regards,

Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

@shloke04 Thanks for your solution, however my requirement is not fit, the above solution provided by @palanikumar  helped