Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

CRM 2011: Update selected records in Account grid

$
0
0

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.');
    }
}


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>