I had the following two requirements to implement.

  1. Change account type field on account as soon as a first opportunity is added to that account.
  2. Change account type field on account as soon as opportunity is closed won.

So my query here is, if we are building a process to accommodate both the requirement and inserting millions of records to the system, what are the chances I would hit the platform limits?

Is processes truly bulkified?

I saw this Release Note but couldn't come to conclusion. If it's not bulkified I would go for Triggers.

  • Are you looking for any more detail here? It seems like this question may be too broad to answer completely.
    – Adrian Larson
    Mar 9 '16 at 20:55

I typically advocate that if you can do something in Salesforce in a declarative way, you probably should.

However, I think your situation is different because of the sheer volume you expect. In addition to (potentially) more robust bulkification, you will be able to achieve much better error handling through Apex. Errors are fairly opaque via Process Builder last I checked. In addition to improving message clarity, this will allow you to support partial success operations, instead of making them all or none in the case of a failure.

A fairly common pattern for mapping errors in this case would look something like:

    update relatedAccounts;
catch (DmlException dmx)
    Map<Id, List<Opportunity>> accountToOpportunities = new Map<Id, List<Opportunity>>();
    for (Opportunity opportunity : opportunities)
        if (!accountToOpportunities.containsKey(opportunity.AccountId))
            accountToOpportunities.put(opportunity.AccountId, new List<Opportunity>();

    for (Integer i = 0; i < dmx.getNumDml(); i++)
        Account relatedAccount = relatedAccounts[dmx.getDmlIndex(i)];
        for (Opportunity opportunity : accountToOpportunities.get(relatedAccount.Id))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.