We have a button on the Account grid ribbon which should update a field on all selected accounts.
Can anyone tell me how to convert this CRM 4 function to work in CRM 2011 please?
function ApplyTierToSelectedRecords(nTier) {var a = document.all['crmGrid'].InnerGrid.SelectedRecords;
var bError = false;
var totalAccounts = 0;
var childAccounts = 0;
for (var i = 0; i < a.length; i++) {
totalAccounts++;
if (IsTopParent(a[i][0])) {
childAccounts++;
}
else {
if (SetTier(a[i][0], nTier) == false)
bError = true;
}
}
if (childAccounts > 0)
alert('WARNING! ' + childAccounts + '/' + totalAccounts + ' of the records you selected are not top-level parent records.');
else {
if (!bError)
alert('Tier-selection was successfully applied.');
else
alert('WARNING! Errors were encountered whilst applying tier-select.');
}
}