
Hi,
I'm trying to hide a button from the ribbon in an 'Associated View', and I tried to setup an enable rule depending on a javascript function. I want to hide the button if there are at least one row in the grid, or show it if there are no rows... I've searched a lot in forums and I can't seem to find an answer. Maybe there is an easy way to do this without javascript.
We are working with CRM 2015 online update 1, I hope someone has an idea on how can I make this work.
Thanks a lot in advance,
-JaimeN
*This post is locked for comments
I have the same question (0)Hi,
you can use similar code to get associated records
var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/SalesOrderSet?$select=Name&$filter=AccountId/Id eq (guid'')", false);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (this.readyState === 4) {
this.onreadystatechange = null;
if (this.status === 200) {
var returned = JSON.parse(this.responseText).d;
var results = returned.results;
if (results.length >= 1) {
return false;
}
else {
return true;
}
}
else {
alert(this.statusText);
}
}
};
req.send();
Here i am retrieving orders associated with account, by passing account id.
and when you get result return true or false to show or hide associated button.
Hope this will help..