最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - How do I refresh the list on the homepage view of an entity - Stack Overflow

programmeradmin5浏览0评论

I have a custom ribbon button on one of my CRM 2011 entities that will effectively disable that entity.

I then would like to refresh the current view on the homepage of that entity. I would like this triggered by JS.

Currently I'm able to refresh the whole parent window which will put me back at the dashboard and not the home page of that entity.

Thanks!

I have a custom ribbon button on one of my CRM 2011 entities that will effectively disable that entity.

I then would like to refresh the current view on the homepage of that entity. I would like this triggered by JS.

Currently I'm able to refresh the whole parent window which will put me back at the dashboard and not the home page of that entity.

Thanks!

Share Improve this question asked Nov 25, 2011 at 16:30 user1231231412user1231231412 1,6592 gold badges26 silver badges42 bronze badges 1
  • What do you mean by "home page"? The page where you see multiple records of that entity, or the editor page of a single record? and by disable, you mean deactivate? – Renaud Dumont Commented Nov 25, 2011 at 21:08
Add a ment  | 

2 Answers 2

Reset to default 4

Good question. Here are two ways you can do it:

//refreshes the entire element in the parent window that contains the view
window.parent.opener.location.reload();

//refreshes just the grid control that contains the view (probably what you're looking for)
window.parent.opener.document.getElementById("crmGrid").control.refresh();

If someone is ing here for Dynamics 365

Do the following for the custom Ribbon Button:

  • Add the PrimaryControl as CrmParameter to your JS function
  • Use the following code to refresh the list:

    function yourJSFunction(primaryControl) {
        // Do your stuff
        primaryControl.refresh();
    }
    

    Example for Xrm.WebApi.online.executeMultiple(...):

    function yourJSFunction(primaryControl) {
        // Create the requests
        // ...
    
        Xrm.WebApi.online.executeMultiple(requests)
                         .then(function (result) {
                             primaryControl.refresh();
                         });
    }
    
  • 发布评论

    评论列表(0)

    1. 暂无评论