Apex · Salesforce

Over come 200 record update limit on OnClick Javascript button click

Salesforce have limitation(only 200 records can be updated) on the OnClick Javascript button click.


Workaround : If really business want to update more than 200 records you can call apex class webservice method inside OnClick Javascript. Please use below sample code

Apex Class :

global with sharing class apexClassname{ 
    webService static String methodName(parm1, parm2,....) 
       return 'Result';

OnClick Javascript:

var result = sforce.apex.execute("apexClassName","methodName",{Parm1:"{!Account.Id}"},Parm2:"{!Account.Name}"});

Note: Use this approach when your business case is less than 2500 records. you can increase record count based # of trigger will be executed in the background. if system have more business logic then you will get “apex cpu time limit exceeded ” exception.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s