- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2022 05:15 AM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 04:52 AM
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
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 04:49 AM
Hi,
Can you share more details on your widget code and a screenshot of your portal page as well?
You can auto refresh a widget using a client controller itself:
function($scope,spUtil) {
setTimeout(function(){
spUtil.update($scope);
}, 3000);
}
The only catch here is that setTimeout won't work on client controller instead we have to use $timeout or $interval to call the function at regular intervals.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 04:52 AM
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
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 05:52 AM
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 06:31 AM
Hi,
You should set data.refresh = 'true' only if the language is change. If it is not changed then set data.refresh = 'false'
If you cant implement the above logic in the code for some reason then as a work around we can set the value in current session. This will make sure refresh does not trigger until you closed the browser and login again. You can use the below script in server script
var session = gs.getSession();
var clientData = session.getClientData('languageCheck');
if(clientData != 'true'){
data.refresh = 'true';
session.putClientData('languageCheck', 'true');
}else{
data.refresh = 'false';
}
Palani