web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Update paginglimit in usersettings with javascript and refresh main grid

(0) ShareShare
ReportReport
Posted on by
Hi everybody,
i have a small problem with refreshing the main grid after javascript update paginglimit in usersettings entity. This is what i have done:
1) i created in ribbon a a dropdown with 5 command buttons. Each button has signed value, as you see on the picture.
2) I created and added javascript ressource. If use klick on one of 5 buttons, javascript will start. This code will get parameter from a button and pass it to JS as first parameter. Based on userId and this parameter a user settings will be updated.
function setROwsPerPage(rowsPerPage, selectedControl) {    console.log(/Start 6/);var userSettings = Xrm.Utility.getGlobalContext().userSettings;var currentuserid = userSettings.userId.replace(/{/, //).replace(/}/, //);var data = {/paginglimit/: rowsPerPage};// update the recordXrm.Utility.showProgressIndicator(/Benutzereinstellungen werden aktualisiert, bitte warten.../);Xrm.WebApi.updateRecord(/usersettings/, currentuserid, data).then(function success(result) {            console.log(/UserSettings updated/);              Xrm.Utility.closeProgressIndicator();            window.parent.location.reload(true);},function (error) {console.log(error.message);Xrm.Utility.closeProgressIndicator();});}
My problem is: this code work just ok but after the page is refreshed the number of rows per page has not changed. Changes are visible only, when i klick butto two times - First time it will update record and page, but the number of row on the screnn did not changen. After secord time the number on the screen did changen.
 
I tried with settimeout fo 5 and 10 seconds but it it not working. Is there any solution, how can i achive this? 
We do not wannt to go everytime into personal settings to change rows per page... it take too much time and we did it a couple of times per hour. 
I have the same question (0)
  • Dengliang Li Profile Picture
    Microsoft Employee on at
    Hi,
     
    I encountered the same issue as you when testing your code.
     
    When I try to manually refresh after removing this line of code.
    With hard refresh (ctrl+F5) you can change the number of rows per page at once. Whereas a normal refresh (F5) takes two times to change the number of rows per page.

    Therefore, it requires code that can implement a hard refresh to change the number of rows at a time.
     
    According to this documentation.
    Location: reload() method - Web APIs | MDN (mozilla.org)
    Pass true to force a reload bypassing the cache. Defaults to false. Only supported in Firefox.
    For all other browsers this method of refreshing is equivalent to a F5 refresh.
    ​​​​​​​
    Unfortunately, I didn't find code that would implement a hard refresh.
    Here are some links about hard refresh using JS.
    https://stackoverflow.com/questions/5721704/window-location-reload-with-clear-cache?noredirect=1&lq=1
    https://stackoverflow.com/questions/2099201/javascript-hard-refresh-of-current-page?noredirect=1&lq=1

    Best Regards,
    Dengliang Li
    ​​​​​​​
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 81 Super User 2026 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#3
11manish Profile Picture

11manish 62

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans