Site icon @WonderLaura

Email Hyperlink to Form

Over the years I’ve written a few posts about hyperlinks in SharePoint, and emailing hyperlinks.  Now with Power Apps, I’m getting this question pretty often.  In this post, I’ll explain how to send a hyperlink to an item in SharePoint, in an email from PowerApps, and how to do it in Flow as well.

Here are my related posts:

Workflow: Create a hyperlink

InfoPath Email Link to Browser Form

Custom Hyperlink Icon Column

SharePoint URL Basics

First of all, there’s a huge difference between sending a link to a SharePoint list item that’s been customized with PowerApps, and sending a link to a standalone PowerApp, to a specific item.  This post is about customized SharePoint list forms, not standalone apps.

The syntax for the link to a SharePoint list item is:

SITEURL/lists/LISTNAME/newform.aspx

SITEURL/lists/LISTNAME/dispform.aspx?ID=X

SITEURL/lists/LISTNAME/newform.aspx?ID=X

 

In the above, X is the unique ID of the item in the list.  Everything in every SharePoint list and library has an ID that is unique in that list.

So an example URL to get directly to the edit form for item number 5 in my travel list is:

https://wonderlaura.sharepoint.com/sites/travelsite/lists/travel/editform.aspx?ID=5

In most cases in my experience, people want to get the link directly to the edit form in the email, instead of the display form.  With SharePoint Designer 2013 workflows, there’s the workflow context link to the item, and in PowerApps, there’s also a link to item field.  Both of those take you to the display form.  In order to link to the edit form, you won’t be using that default link.  Also, keep in mind that in order to send a link to an item, the item has to exist first, and has to have an ID, so with a brand new form, this is something to keep in mind.  If you’re sending a link directly from PowerApps without using Flow, the item still does have to be saved/submitted first.  So, the best standard way to do this, will be to use the OnSuccess property of the form control in PowerApps.

To send a link to the edit form, directly from PowerApps, for a list form customized in PowerApps:

  1. In PowerApps, add a connection to email if you haven’t already.  On the View menu, choose Data Sources, and if you don’t already see something that looks like this:

    Click Add data source to create this if it’s not already there.  In the list of connections to add, it’s called Office 365 Outlook.
  2. In PowerApps, select your form control.  By default, it’s called SharePointForm1.  Go to the OnSuccess property. 
  3. There will probably already be a couple of actions in there, to reset the form and hide it.  You’ll be adding the send email action in front of those.  Here is the syntax:

    As you can see, the tricky part is in the body of the email, where it starts with test link to item.  Notice the double quotes around the URL.  Also, the IsHtml is really important.  In that example, I have just hard coded the full URL to the site and list, so you’ll use your own URL in there.
  4. You can also make this dynamic, so that you can use the same formula in all of your PowerApps.  Here is the dynamic string, which uses the URL to your site and list.

Office365.SendEmail(
“tester@tester.com”,
“This is the subject”,
“test link to item <a href=””” & Left(SharePointForm1.LastSubmit.'{Link}’,Find(“_layouts”,SharePointForm1.LastSubmit.'{Link}’)-1) & SharePointForm1.LastSubmit.'{Path}’ & “EditForm.aspx?ID=” &SharePointForm1.LastSubmit.ID & “””> CLICK HERE </a>”,
{IsHtml: true}
)

Here is what this same thing would look like in a Microsoft Flow Send an Email action (Office 365 Outlook).  But of course, if you send the email directly from PowerApps, you don’t need Flow for that.

 

Here is my video, teaching you all about sending email directly from PowerApps:

In this video, learn how to send emails directly from within PowerApps, without the need for Microsoft Flow. Emails can even be customized with HTML, and lists of items can be sent as well.

https://www.iwmentor.com/pages/powerapps-send-email

 

If you’re looking for instructions for doing this with a standalone app, I haven’t written a post about it yet, but I do cover it in great detail in my PowerApps Training class.  It’s much more complicated of a process.


Exit mobile version