function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
msaz87msaz87 

Process Builder error: Record rolled back because not all records were valid and the request was using AllOrNone header

I'm getting the following error in a Process Builder rule, and I'm not sure why. The rule fires when a user lookup field on the Account changes. When that field changes, it changes all of the Account's Contacts ownerId to equal the new field value.

Here's the error:
An error occurred at element myRule_1_A1 (FlowRecordUpdate).
    UPDATE --- UPDATE FAILED --- ERRORS : (ALL_OR_NONE_OPERATION_ROLLED_BACK) Record rolled back because not all records were valid and the request was using AllOrNone header --- for SFDC record with ID : 003A000001VHDehIAH, 

    This report lists the elements that the flow interview executed. The report is a beta feature.
    We welcome your feedback on IdeaExchange.

    Flow Details
    Flow Name: Update_Contact_to_Pipeline_Rep
    Type: Workflow
    Version: 1
    Status: Active

    Flow Interview Details
    Interview Label: Update_Contact_to_Pipeline_Rep-1_Account
    Current User: xxUserxx (005A0000005FohB)
    Start time: 3/2/2016 2:24 PM
    Duration: 28 seconds

    How the Interview Started
    Chris Thames (005A0000005FohB) started the flow interview.
    Some of this flow's variables were set when the interview started.
    myVariable_old = 001A0000014JsaDIAS
    myVariable_current = 001A0000014JsaDIAS
    RecursiveCountVariable = 0.00

    ASSIGNMENT: myVariable_waitStartTimeAssignment
    {!myVariable_waitStartTimeVariable} Equals {!Flow.CurrentDateTime}
    Result
    {!myVariable_waitStartTimeVariable} = "3/2/2016 2:24 PM"

    DECISION: isChangedDecision2_myRule_1_Pipeline_Rep_c
    Executed this outcome: isChangedRule_2_myRule_1_Pipeline_Rep_c
    Outcome conditions: and
    1. {!myVariable_old} (001A0000014JsaDIAS) Is null false
    2. {!myVariable_old.Pipeline_Rep__c} (005A0000007DuG5IAK) Does not equal {!myVariable_current.Pipeline_Rep__c} (005A0000005FohBIAS)
    Logic: All conditions must be true (AND)

    DECISION: myDecision
    Executed this outcome: myRule_1
    Outcome conditions: and
    1. {!isChangedRule_2_myRule_1_Pipeline_Rep_c} (true) Equals true
    2. {!myVariable_current.Pipeline_Rep__c} (005A0000005FohBIAS) Is null false
    Logic: All conditions must be true (AND)

    RECORD UPDATE: myRule_1_A1
    Find all Contact records where:
    AccountId Equals {!myVariable_current.Id} (001A0000014JsaDIAS)
    Update the records’ field values.
    OwnerId = {!myVariable_current.Pipeline_Rep__c} (005A0000005FohBIAS)
    Result
    Failed to update records that meet the filter criteria.

    Error Occurred: UPDATE --- UPDATE FAILED --- ERRORS : (ALL_OR_NONE_OPERATION_ROLLED_BACK) Record rolled back because not all records were valid and the request was using AllOrNone header --- for SFDC record with ID : 003A000001VHDehIAH,

 
Parker EdelmannParker Edelmann
Try adding a lookup element that assigns the contact records to an sObject collection variable and pass that off to a loop element. From there have it iterate through the list, and update each contact Owner Id individually to the variable. Hopefully that should avoid the error you're running into.

Thanks,
Parker
msaz87msaz87
Hi Parker,

I'm brand new to Process Builder -- can you give me a little more of a walkthrough on how to achieve that?

Thanks,

-Matt
Parker EdelmannParker Edelmann
Can you give a screenshot of what you have so that I know where to begin?
msaz87msaz87
Sure thing... below are all the pieces to the current Process.

User-added image

User-added image

User-added image
*Both fields in the conditions for "Pipeline Rep Changes" are the same

User-added image
Parker EdelmannParker Edelmann
First off, from the error report I mistakenly asssumed that you set the process to launch a flow, so the advice I gave in the first reply pertained to Visual Workflow, not Process Builder, sorry about that. Second, your process is completely valid, it should work like a well oiled machine, unless Pipeline Rep is not a lookup to user like I assume it is. Lastly, the AllOrNone header error in the report means that there is some validation error in contacts on at least one of your records. If you've set up any new validation rules on contacts, and the contacts no longer pass validation, or referencing Pipeline Rep to Owner makes issues, it will cause your process give that error. From the report, it looks like a contact with the ID of 003A000001VHDehIAH is the faulty record.

For more on the AllOrNone header see this page I found https://developer.salesforce.com/docs/atlas.en-us.198.0.api_meta.meta/api_meta/meta_allornoneheader.htm
msaz87msaz87
I think I've established that the problem might actually be with the number of records Process Builder is trying to update. I checked the Account and there's more than 1,600 Contacts that it's trying to change the owner for... and since PB is not bulkified, this might be causing problems.

Do you know any way to stop the PB if the number of matched records exceeds a certain amount?
Parker EdelmannParker Edelmann
That doesn't seem right. The error log would have said something about a SOQL query limit or a DML statement issue, but it didn't. Also, the process builder was bulkified so that when it writes the queries, it crams as many of them as possible into one without hitting character limits. Have you made sure that the contact record the error pulled up meets current validation standards? I've searched for limitations with process builder and this is the closest thing that I can come up with to fit what you're saying is happening, but nothing that directly states an update record limit. Heres the article:
https://help.salesforce.com/apex/HTViewHelpDoc?id=process_limits.htm&language=en_US
msaz87msaz87
I checked validation rules and there's only one, which isn't causing the error. I took the Contact that the error was mentioning (003A000001VHDehIAH) and tried manually changing its owner and it processed fine... I also made a meaningless update to the record and saved it to see if any validation rules would trigger and that didn't happen either... so I'm not sure where the error is occurring.
Parker EdelmannParker Edelmann
Well, I'm out of ideas. Run the process until it works I guess. If you create a roll up summary field on accounts and tell it to count the number of contacts related to it, you can use that field in the process criteria. That would be a way to keep the process from firing if the number is too large, but I still can't figure out why it gave you the error. Perhaps I did miss something and there is a limitation, but there's the solution to preventing it from happening. Thanks for listening to me and giving me a little homework on process builder in the process.

Parker
msaz87msaz87
Absolutely I appreciate the help -- I'm trying to learn as much as I can with it also. I actually did try to create a roll up summary field at the Account level to tell me how many Contacts were on each Account, but it doesn't look like that's possible. Some Google searches made it seem like this is a lacking feature -- have you found any way to do that?
Parker EdelmannParker Edelmann
You just love making me do homework don't you? Yes, I tried in my Developer Edition now that you mention it, you can't create a field from accounts to contacts even though they have a master detail relationship. But as I looked at the Help site, I found this workaround that might work, but I have no idea since I know less than nothing about code.
https://developer.salesforce.com/forums?id=906F00000008lW0IAI

Oh, and by the way, don't mark this question as solved by giving it a best answer, someone with a good idea might come along and answer your question, unless you're content with not having a process that works for you after all this.
If you have any more questions about processes or formulas, I'd be happy to help.

Thanks again,
Parker
ZX CheowZX Cheow
Hi Msaz87,

Do you manage to solve this issue? I am having the same error message when importing 200 opportunities which will trigger a process flow to update the Account.

Currently the only workaround spotted is to reduce the batch size from 200 to 30 and the import will work flawlessly.
Carmen Woo 2Carmen Woo 2
Hey msaz87 & second ZX Cheow, I changed my batch size from 200 to 3 (not even 30) and my Contact update worked.

Good luck!
Carl Herman 4Carl Herman 4
Hi all,
I ran into a very similar error.
We have a custom object that looks up to the Opportunity object.
When an Opportunity is marked as "Closed Lost" we have a process that updates the custom objects related to that Opportunity.
I found that the error came from a validation rule.

Interestingly, the record that was specified in the error email WAS NOT THE RECORD THAT WAS VIOLATING THE VALIDATION RULE.
I highly suggest taking a look at your Contact validation rules.
Maybe do a test where you disable all of them and then try to execute this process again.
I bet it'll work for you.
That won't tell you WHICH contact was violating the validation rule, but it'll at least put you on the right path.

I'm interested to see if this works for you.
Thanks!