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