@@salesforcein5minutes won't you get PENDING TRANSACTION error ? I think standard practice is to always do callout first and then do the DML or just do the callout in future method.
@@salesforcein5minutes in LWC controller Execution will not wait until response received from the callout, and we need to handle the response received and need to convert it to json Object and then pass the returned value to the apex method imperatively, May be I think we need to make use of async and await or promise chain in this scenario, but I am not sure.
@@awesomekj5812 yeah but we check id is there or not and after that we make a callout, basically if id was available that means record creation is done successfully and that operation is done
How can we perform dml operation and rest callout in a single transaction from lwc
First make the dml and check if id is not null and then make immediately callout to the system if its not null
@@salesforcein5minutes won't you get PENDING TRANSACTION error ? I think standard practice is to always do callout first and then do the DML or just do the callout in future method.
@@salesforcein5minutes in LWC controller Execution will not wait until response received from the callout, and we need to handle the response received and need to convert it to json Object and then pass the returned value to the apex method imperatively, May be I think we need to make use of async and await or promise chain in this scenario, but I am not sure.
@@awesomekj5812 yeah but we check id is there or not and after that we make a callout, basically if id was available that means record creation is done successfully and that operation is done
@@pradeepaksks-bx8ip you can also use platform. Events for such cases