I am using Salesforce Lightning mode and looking to use the configure not code approach.
I have an external service defined.
The scenario I am trying to implment is as follows:
- User Creates Contact in Salesforce
- Automatically invoke external web service with some data from the new Contact
- Retrieve relevant data from external service response
- Update the new contact with the data
My first attempt was to create a Record-Triggered Flow that was activated when a new Contact entity was created. The flow was then able to assign relevant variables before triggering an Action which invoked my external service.
The problem I had with this is that the error "'You have uncommitted work pending. Please commit or rollback before calling out' error" appeared which led me to this article: https://help.salesforce.com/articleView?id=000328873&type=1&mode=1
So the problem as I understood it was that I cannot invoke an external service in a flow that is triggered by a contact creation.
So then I looked at creating a Process which would invoke a Flow. The process is one that starts "When a record changes" and that record is set to be a Contact record that is created. The process then is supposed to call my Flow which will do the actual external service invocation.
But I still get the same issue with the "'You have uncommitted work pending.'" message.
Even if I change the invocation of the Flow from the Process via a scheduled action I get the same error.
Any thoughts on how I should be doing this?