Power Apps Deep Links: Email Direct Link To A Specific Record

Power Apps Deep Links: Email Direct Link To A Specific Record

Deep links are a type of hyperlink that send an app user to a specific record or screen. In Power Apps deep links are most useful when sent in an email. The recipient can click on a deep link to open an app and immediately navigate to the information they need with no extra effort. In this article I will show you how to send an email with deep links that immediately open Power Apps to a specific record or screen.

Table Of Contents
Introduction: The Create A Support Ticket App
Setup The SharePoint List
Create An Edit Form
Make A Submit Button For The Edit Form
Get the Canvas App Web Link
Send An Email With A Direct Link To A Specific Record
Obtain A Record ID From The App OnStart
Submit A Support Ticket To Generate An Email
Build A Gallery Showing All Support Tickets
Define The App StartScreen Property




Introduction: The Create A Support Ticket App

The Create A Support Ticket app is used by employees at a manufacturing company to ask the I/T department for help with technology related issues. After a support ticket is submitted, the employee receives and email with a link that allows them to go back and review the support ticket they created in the system.




Setup The SharePoint List

Create a new SharePoint list called Support Tickets with the following columns:

  • ID (whole number column)
  • Title (single-line text)
  • IssueType (choice) [Options: Desktop/Laptop, Business Application, Internet, Virus]
  • Description (multiple line text)
  • Created (person column)
  • Created By (date & time column)


It is not necessary to create the columns ID, Created and Created By since they are included by default in any SharePoint list. However, we we must unhide them by going the the Show/Hide Columns menu and checking the box beside their columns names.



Once created the Support Tickets SharePoint list does not require any data to be loaded. We will make some new support tickets while building the app.

IDTitleIssueTypeDescriptionCreatedCreatedBy




Create An Edit Form

When an employee opens the Create A Support Ticket app they fill-in a form with details about their technology issue and submit the form to the I/T department. Open a Power Apps Studio and make a new canvas app from blank. Then add a label to the top to act as a titlebar.



Connect the Support Tickets SharePoint list to the app.



Then insert an Edit Form and select Support Tickets as the datasource for the the form.



Include only the Title, Issue Type and Description fields in the form. The fields ID, Created and Created By will be automatically generated when a new support ticket is created.



Also, change the DefaultMode property of the app to this code to specify that a new record should be added to the SharePoint list when the form is submitted.

FormMode.New




Make A Submit Button For The Edit Form

Now that the form is finished we need to add a submit button. Insert a new button below the form with the text “Submit”.



Use this code in the OnSelect property of the form to submit the form details to the SharePoint list.

SubmitForm(frm_Form_Support)



Then add this code to the OnSuccess property of the form to define what happens after the new ticket is successfully created. We want to capture the ticket details in a variable called varRecordTicket, change the form to view-mode and then show a banner at the top of the screen to let the employee know their ticket was saved.

Set(varRecordTicket, frm_Form_Support.LastSubmit);
ViewForm(frm_Form_Support);
Notify("Success: Your support ticket was submitted", NotificationType.Success);



Put this code in the Item property of the form so it knows which record to display while in view-mode…

varRecordTicket



…and finally, use this code in the Visible property of the submit button to hide it after the ticket is submitted.

frm_Form_Support.Mode<>FormMode.View

To generate a direct link to the submitted ticket we must first obtain the app’s web link. Save and publish the Create A Support Ticket app then open the make.powerapps.com and click the three dots beside the app’s name. Select the details menu item.



The web link can be found on the details tab.



Copy the web link into windows notepad or some other note taking app. We will need it in just a moment.

https://apps.powerapps.com/play/d77ba81c-d7e4-4131-bb06-12b172225819?tenantId=f1b8b509-50a4-4a5c-8e48-bf3d3e7c10ed

After a support ticket is submitted employees will receive an email with a direct link to the support ticket in Power Apps. Go to Power Automate and build a new automated cloud flow called Support Tickets: Send Notification Email. Choose When an item is created for the trigger.



Add two actions to the flow: Compose (Data Operations) and Send An Email V2 (Outlook). Fill-in the actions as shown in the image below.



In the compose step of the flow we are writing HTML code to insert into the body of the notification email. The direct link to a specific record can be found inside the <a> tags. We take the web link for the app and add a URL parameter called supportticketid. This parameter is filled with the unique ID number from the Support Tickets SharePoint list.

<html>

<body>

You submitted a support ticket.  To check the details of your support ticket please click on the link below.<br>
<br>

<a href="https://apps.powerapps.com/play/d77ba81c-d7e4-4131-bb06-12b172225819?tenantId=f1b8b509-50a4-4a5c-8e48-bf3d3e7c10ed&supportticketid=@{triggerOutputs()?['body/ID']}">Link To Support Ticket</a>

</body>

</html>


Save and close the flow. We will test the deep link soon, but first, we must make some more changes to the app.




Obtain A Record ID From The App OnStart Property

When the app opens it must check whether a record ID was supplied inside the supportticketid URL parameter. If supportticketid has a value, the form should display that record, otherwise, it will appear blank.



Use this code in the OnStart property of the app. It performs a lookup on the supportticketid URL parameter and stores the result in the varRecordTicket variable. If a record was found it changes the form to view mode (instead of new mode which is the default we setup earlier).

Set(
    varRecordTicket,
    LookUp(
        'Support Tickets',
        ID = Value(Param("supportticketid"))
    )
);
If(
    !IsBlank(varRecordTicket),
    ViewForm(frm_Form_Support)
)



We will also make another small modification to the titlebar’s text.



When the form is in new mode the titlebar will show the text “Create A Support Ticket”, otherwise, it will display the ticket ID number. Use this code in the Text property of the titlebar.

If(
    frm_Form_Support.Mode=FormMode.New,
    "Create A Support Ticket",
    "Support Ticket #"&varRecordTicket.ID
)



Submit A Support Ticket To Generate An Email

We can now test our app to confirm it generates and email with a direct link to the submitted record. Fill-in the support ticket form with the data shown below.



Then wait a few moments and an email will appear with a direct link to the support ticket record. Click on the link.



When we click on the link the app opens with the form in view-mode and displays the support ticket details.

The Create A Support Ticket app also has another screen where an employee can see all of the support tickets they have submitted. After making this new screen we will tell our app which screen it should open to: the Support Ticket List Screen or the Support Ticket Form screen.

Add a new blank screen to the app and insert a gallery. Connect the gallery to the Support Tickets SharePoint list.



Change the gallery layout to Title, subtitle and body.



Then update the gallery data fields to the values shown in the image below.



When an employee clicks on a support ticket they should be able to view its details and perform edits.



Put this code in the OnSelect property of the gallery.

Set(varRecordTicket, ThisItem);
EditForm(frm_Form_Support);
Navigate('Support Ticket Form Screen', Fade);



We also need a way for employees to add new tickets. Insert an add icon at the top of the screen…



…then use this code in the OnSelect property of the icon.

Set(varRecordTicket, Blank());
NewForm(frm_Form_Support);
Navigate('Support Ticket Form Screen', Fade);



One more thing. Once the employee arrives at the form screen they need a way to get back to the list screen. Place a left arrow icon in the top left corner of the form screen.



Then write this code in the OnSelect property of the icon.

Navigate('Support Ticket List Screen')




Define The App StartScreen Property

Once the app is opened it must determine which screen to load: the support ticket list screen or the support ticket form screen.



We do this by writing an if statement in the the StartScreen property of the app. If the supportticketid URL parameter is blank the app opens to the list screen. But if supportticketid does have a value then the app opens to the form screen.

If(
    IsBlank(Param("supportticketid")),
    'Support Ticket List Screen',
    'Support Ticket Form Screen'
)





Questions?

If you have any questions or feedback about Power Apps Deep Links: Email Direct Link To A Specific Record please leave a message in the comments section below. You can post using your email address and are not required to create an account to join the discussion.

Matthew Devaney

Subscribe
Notify of
guest
27 Comments
Oldest
Newest
Inline Feedbacks
View all comments
aydar sitdikov
aydar sitdikov
11 months ago

Thank you! this needs to be tested. a very, very necessary feature! ?
it will work if there is a screen if there is a screen form and there is a gallery next to it?

Last edited 11 months ago by aydar sitdikov
sitdikov aydar
sitdikov aydar
11 months ago

Thank you! is this possible due to the release of the new App.StartScreen feature?

Inderjeet Singh
Inderjeet Singh
11 months ago

Thanks a lot for the article. How could we secure the URL link? Anyone could change the Item ID and could open other requests.

Luke
5 months ago

A user may be allowed to see all the records, but we don’t want them to be able to change the ID to see them.

Is there a way to add additional parameters so that the ID and other data values need to match before showing the page? For instance, for your example, the ticket title in addition to the ID. Thanks.

Last edited 5 months ago by Luke
Anthony
Anthony
10 months ago

I think there are some little mistakes

SubmitForm(frm_Form_Submit)

for me it’s (frm_Form_Support)

Set(varRecordTicket, frm_Form_Support.LastSubmit);
ViewForm(frm_Form_Support);
Notify(“Success: Your support ticket was submitted”, NotificationType.Success);

No ; at the end of the formula.

To be continued 😉

Anthony
Anthony
10 months ago

An another question : what is the interest to use compose action in this case ?

aydar sitdikov
aydar sitdikov
10 months ago

is it possible to make this link if the application is embedded in a tab in teams?

Last edited 10 months ago by aydar sitdikov
Priya
Priya
10 months ago

Thanks Matthew!
Great post, I could easily apply this with multiple parameters and also link to Power BI.
Question- could you share on- ways to mask the Weblink to an app by a valid name ( instead of alphanumeric URL) which is unique to each app ?

Thank you.

Priya
Priya
10 months ago

HI Matthew,
It could be replacing a Weblink that looks like –

https://apps.powerapps.com/play/d77ba81c-d7e4-4131-bb06-12b172225819?tenantId=f1b8b509-50a4-4a5c-8e48-bf3d3e7c10ed

By something meaningful (masking) –
https://apps.powerapps.com/MyappCatalyst

Thanks,
Priya

Kyle
Kyle
10 months ago

Thank you very much for the detailed example. It took me a bit to wrap my head around it and adopt this for my scenario. It works great…..

marc
marc
6 months ago

Hey Matthew. First of all, thanks for all your articles and information.

For some reason, whenever, I click the link in my email it ALWAYS opens the form in NEW mode and never the actual VIEW mode.

Any ideas as to what I am doing wrong?

Ngoc Pham
Ngoc Pham
5 months ago

Hi Matthew,

Thanks for sharing your article 🙂
However, when I clicked URL in my email it ALWAYS opened a NEW form in Edit mode even though on the web browser’s URL, it specified the correct item number(
https://….&supportticketid=7) Please advise. Thanks

Ngoc Pham
Ngoc Pham
5 months ago

Hi Matthew,

Your instruction worked now.. THANKS

However, when I applied your instruction to mine… After clicking on the email’s URL, It only opened the main screen and I got “Getting your data” msg stuck even thought the URL browser listed the correct record ID number.

https://apps…..&hidenavbar=true&RCSID=780

My gallery’s selected item

If(NewForm(EditForm),ViewForm(EditForm);Set(varRCS, ThisItem),ViewForm(EditForm))

After the users click on the gallery’s selected item, they can view the selected item’s info and they can click on “Pencil” icon / “trash” icon for editing / deleting the selected item. Note that Gallery and ViewForm(EditForm) are on the same screen

My OnStart

Set(varRCSID,LookUp(‘RCS Requests’, ID = Value(Param(“RCSID”))));
If(!IsBlank(varRCSID),ViewForm(EditForm))

Ngoc Pham
Ngoc Pham
5 months ago

Hi Matthew,

Thanks.
Does your instruction work for SharePoint TASK list ?
Does it also work for updating ? (I had a Power Automate flow to send a msg when SharePoint TASK item is created or modified)

THANKS so much for your support 🙂

PowerApps.Rocks
3 months ago

There is another link syntax to use for emails/notifications/etc. which will open a PowerApp in the native container app:

ms-apps:////providers/Microsoft.PowerApps/apps/<appID>

  • This works if you know that all users have the PowerApps container app installed on their devices
  • This does not work for desktop/laptop users, but definitely has its place!

Reference

Last edited 3 months ago by PowerApps.Rocks
Ricardo
Ricardo
10 days ago

Nice post Matthew.
Everything is working in my canvas apps but I have a special app that is a Model driven app with Custom Pages (with multiple screens).
Is it possible to implement deep linking for this case of custom pages? because I’m not being able to pass parameters to custom pages like in this example

https://XXXXX.com/main.aspx?appid=1359be2c-9ae4-ec11-bb3c-000d3ab03817&pagetype=custom&name=new_components_a54be&id=309

the id parameter is my added parameter to try to open the desired screen with the record that I want but the problem is that is not allowed. Is there a way to implement that I want?

Thanks in advance