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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

I need to hide Resolve case and Cancel case button on Homepage grid

(0) ShareShare
ReportReport
Posted on by 5

I need to hide Resolve case and Cancel case button on Homepage grid. I have written the code 

async function HideReport(selectedIds,selectedControl)
{
debugger;
  var id;

id = selectedIds[0].replace(/[\[\]']+/g, '');
        var processtypeId;

await Xrm.WebApi.online.retrieveRecord("incident", id,"?$select=_lgr_processtypeid_value").then(

        function success(result)
            {
             processtypeId = result._lgr_processtypeid_value

});

var isVisible = true;

 await  Xrm.WebApi.online.retrieveRecord("lgr_processtype", processtypeId, "?$select=lgr_hideclosurecommands").then(

  function success(result)
{
     isVisible= !result.lgr_hideclosurecommands; //return the reverse of the Hide Closure Commands flag

});

    return isVisible;

}

But there is one problem Code is working for Homepage grid but when I open the record the same code is giving error, So Now I need suggestion for that code to work only on Homepage grid but not when I open the record. Please suggest me what to do  i.e Code only have to work on Homepage grid but not on form

I have the same question (0)
  • Suggested answer
    Steve Zhao2 Profile Picture
    Microsoft Employee on at

    Hi saikrishna2345,

    Add a custom rule to Resolve case and Cancel case button with your code by using the Ribbon Workbench should solve your issue.

    pastedimage1669858448168v1.png

    Then publish your solution is ok.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Syed Aqib Raza Profile Picture

Syed Aqib Raza 25

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 23 Most Valuable Professional

#3
Ayesha Wajahat Profile Picture

Ayesha Wajahat 16

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans