... a contemporary perspective on how to integrate B2C Commerce and the Salesforce Customer 360 Platform to power frictionless customer experiences in the B2C domain.
First problem: Multiple auth calls
In B2CIARequestB2CAuthToken when it is invoked by the flow B2C Commerce: Platform Event: Process Contact Update
The first BULK update of accounts containing more than 100 accounts will fail, this is because in the trigger account you publish an event with a collection of 100+ accounts, then in the flow, if you don't have the B2C Token, you call the invokable to make the HTTP callout
Here is the error, you are cycling through N accounts, you are not cycling through unique B2C Id, but you are cycling through N accounts, this is how flow works.
and here is the error
For projects that has only 1 B2C client in our case, since we can't spend much time, we just applied a quick fix by moving the http.send request outside of the loop, since all the accounts will have the same B2C Client and JWT.
But for a more solid package, you may want to make an additional loop by getting a map of unique b2c Id and make X requests.
Second problem: Max calls 101 callouts
when trigger on account is calling B2CProcessPersonAccountHelper.processTrigger(Trigger.new, Trigger.old);
it will trigger the flow B2CCommerce_PlatformEvent_ProcessContactUpdate, which will contain more than 100 accounts and it will then invoke B2C: Publish Customer Profile Definitions or B2C: Get Customer Profile and will make more than 100 callouts.
I have created a Queueable solution to limit to 80 accounts so it will not go over the limit of callouts - this is just a temporary solution, please consider this solution and try to fix it into a more scalable solution rather than using flow and blocking org limit.
This problem may not exist if in lower versions of flows salesforce have a lower bulk size grouping in the core.
First problem: Multiple auth calls In B2CIARequestB2CAuthToken when it is invoked by the flow B2C Commerce: Platform Event: Process Contact Update
The first BULK update of accounts containing more than 100 accounts will fail, this is because in the trigger account you publish an event with a collection of 100+ accounts, then in the flow, if you don't have the B2C Token, you call the invokable to make the HTTP callout
Here is the error, you are cycling through N accounts, you are not cycling through unique B2C Id, but you are cycling through N accounts, this is how flow works.
and here is the error
For projects that has only 1 B2C client in our case, since we can't spend much time, we just applied a quick fix by moving the http.send request outside of the loop, since all the accounts will have the same B2C Client and JWT.
But for a more solid package, you may want to make an additional loop by getting a map of unique b2c Id and make X requests.
Second problem: Max calls 101 callouts when trigger on account is calling B2CProcessPersonAccountHelper.processTrigger(Trigger.new, Trigger.old);
it will trigger the flow B2CCommerce_PlatformEvent_ProcessContactUpdate, which will contain more than 100 accounts and it will then invoke B2C: Publish Customer Profile Definitions or B2C: Get Customer Profile and will make more than 100 callouts.
I have created a Queueable solution to limit to 80 accounts so it will not go over the limit of callouts - this is just a temporary solution, please consider this solution and try to fix it into a more scalable solution rather than using flow and blocking org limit. This problem may not exist if in lower versions of flows salesforce have a lower bulk size grouping in the core.
Best, Sandro Lu Senior Salesforce Architect