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
srikanth mannesrikanth manne 

How can i fix the mixed dml error in lightning

I have 2 methods When i click on button  first method creating contact and second one creating site.externaluser and then login site.
how can i handle this in lightning component.
How can i change the excuting transaction?
Please let me know the solution

 
Rohit Kumar SainiRohit Kumar Saini
Hi Srikanth,

You can call the second method from callback of the first method. This should create two different transactions. Another way is to use setTimeout which runs the method after a specified delay. 

https://www.w3schools.com/jsref/met_win_settimeout.asp

Please share your code if you need any further help.

Thanks.