Lightning-Flow-Scanner / lightning-flow-scanner-vsce

A VSCode Extension designed to pinpoint deviations from Industry Best Practices in Salesforce Flows, ensuring standards of business automation excellence.
https://marketplace.visualstudio.com/items?itemName=ForceConfigControl.lightningflowscanner
GNU Affero General Public License v3.0
29 stars 1 forks source link

New Rule: Avoid accessing external objects after DML operations in a transaction. #34

Closed RubenHalman closed 2 years ago

RubenHalman commented 3 years ago

Avoid accessing external objects after DML operations in a transaction.

If Salesforce creates, updates, or deletes data in your org and then accesses external data in the same transaction, an error occurs. In your flow, we recommend using a separate transaction to access data in an external system. To do so, end the prior transaction by adding a screen or local action to a screen flow or a Pause element to an autolaunched flow. If you use a Pause element, don't use a record-based resume time. For example, a screen flow creates a contact and then displays a confirmation screen. Next, the flow updates the contact in the external system. The flow doesn’t fail because it uses a separate transaction to access the external data.