*** NOTE: ALL INFORMATION IS ACCURATE AT DATE OF PUBLISHING ***
Back at the start of 2019, I wrote a blog about how to set up and use the Forgotten Password Functionality for portals (Power Pages). Functionality exists for a portal that gives a Contact the ability to do a password reset when they have forgotten their password. This exists as a process (old school workflow) that’s an action which generates a unique link for the Contact and then sends it to them in an email. By default it sends it from the owner of the Contact. Although it can be customised, more organisations are using other services such as SendGrid to send out emails, or even just Outlook but setting a specific mailbox as the from address. This post looks at how you can use the action that runs to generate the unique link, but pass it through in to an email using Power Automate.
First, find the process in Dataverse called Send Password Reset To Contact. Disable it so you can edit it, then select the email step that exists. Delete it. We don’t want to have the email sent from here. Now activate the process again. We still need the action to occur and generate the CallbackURL which is the unique link to send to the contact.
Now to create what is perhaps the simplest flow in Power Automate I have ever created. It’s just two steps, the trigger when the request is made by someone on the website, and one action to send out an email.
The trigger is from the Dataverse connector and is When an action is performed. Set the Catalog and Category to (ALL), and the table name to Contact. Then from the list of actions select adx_SendPasswordResetToContact. This means the flow will begin when someone submits their email on the forgotten password page of the portal.
The action can use connectors from SendGrid, Outlook or whatever you want to use to actually send the email. What we now find are values passed through from the action. So for the To field, we can use the Email address we find in the list of dynamic content.
Add a subject, and then you can add the body for the email. Might be easier to add the text you want first, but then click on the tag icon to display the HTML code for the email.
This is where we can add in a pretty link by using an ahref tag like you see below for the Reset Password section. We want the CallbackUrl value that is passed from the action. I just used the standard out of the box email content, but you can put whatever you want. Finally, at the bottom I used an img src tag to display an image.
You can now save the flow and make sure it’s turned on. Then go ahead and test it! Here is the email received. Quick and simple, and so flexible in terms of having control of what is used to send the email. No authenticating of mailboxes and fiddling around with the process. Job done!
Check out the latest post:
Auto Assign Leads Without Code Using Lead Scoring & Work Assignment
This is just 1 of 477 articles. You can browse through all of them by going to the main blog page, or navigate through different categories to find more content you are interested in. You can also subscribe and get new blog posts emailed to you directly.
You are a life saver!
Glad I could help! π
Megan,
Thanks for this! I found that if I disable the “Send Password Reset To Contact” the “When Action Is Performed” action gives me the error: “Request to XRM API failed with error: ” when I try to save the flow. I re-activated it and the flow works. It took me a little while to figure out what was going on. Not sure if there was a change in the system since you wrote this or our set up is somehow different.
Thanks again,
Tim
Hi Tim, you definitely need the original Send Password Reset To Contact enabled. The step in the post states to disable so you can edit it, and then activate it again after editing. Unless I’ve misunderstood your comment!
This is brilliant. The only issue I have is that when I click the password reset link, and reset the password, I get an error message saying Invalid Token? Have you come across this before?
Hi Chris, did you reactivate the original workflow after removing the email step from it?
This is great, Megan! Really useful. Currently, if the email doesn’t exist, then nothing happens. Is it possible to send the entered email address a message to say “entered email address doesn’t exist. Please register”?
Hi Indy, not out of the box. You would need some kind of logic to get the email address from the field submitted, then pass it through in to the flow in Power Automate, then use it to see if a Contact record exists. Then if not, send a different kind of email. Instead, it might be easier to just change the message from “Please check your email to reset your password.”, to something like “If you are already registered, you will receive an email within the next 5 minutes. If you have not registered previously, please click here to do so.”
My ‘Send Password Reset To Contact’ is active, and
Authentication/Registration/ResetPasswordEnabled is true,
still my flow is not triggering. Please help.
bapiraju. If it’s not triggering, try turning the flow off and back on again, then try and trigger it again. If that doesn’t work, try and remove the trigger from the flow then add it back in again. If it’s not triggering, make sure the CRM workflow is actually running which would in turn start your flow.