Skip to main content

I have created a flow to help me with creating community users from contact records because I didn't like exposing the new user form to my users, especially because specific profiles need to be chosen. Anyway, the flow basically takes details from Contact record and sets up a user, but before the user is created they are presented a screen that shows them the user that is about to be created...so that they can make any last minute changes....fix name spelling, add title, update email etc. When they click finish the user record is created and if any changes were made in that screen then the contact gets updated too. All of that works great, but there was one challenge... 

 

There is a thing called mixed dml operations that the platform won't let you do. Basically you can't create a user and update a contact in the same transaction. So, to get around this I sent the updated contact to a sub-flow that has a wait element before the contact update. The wait element solves that mixed dml problem, but introduces another. The wait element drops you into a page that says 'The flow interview is waiting. It will resume in the background when an event occurs.' And it just leaves you there. The contact gets updated, but it never takes you off that page.  So, I'm guessing it's because this is an autolaunched flow and not executing in the context of the visualforce page that the flow that called it was executing in. Therefore, it has no retURL.  This documentation seems to say that I can't set a retURL in an autolaunched flow. https://help.salesforce.com/articleView?id=vpm_url_set_retURL.htm&language=en_US&type=0

 

How can I can redirect back to something, anything? Ideally the contact that the flow started from, or just the recent contacts related list. 

3 commentaires
0/9000