Skip to content

Commit 66eb5ba

Browse files
authored
Merge pull request #1407 from MicrosoftDocs/aneesmsft-CanvasAppEmbedding-Actions
Aneesmsft canvas app embedding actions
2 parents 3a1a460 + 337d1a1 commit 66eb5ba

7 files changed

+109
-3
lines changed

powerapps-docs/maker/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,8 @@
831831
href: ./model-driven-apps/pass-current-embedded-canvas-app.md
832832
- name: "Pass related records to an embedded canvas app"
833833
href: ./model-driven-apps/pass-related-embedded-canvas-app.md
834+
- name: "Perform predefined actions on the host form"
835+
href: ./model-driven-apps/embedded-canvas-app-actions.md
834836
- name: "Share an embedded canvas app"
835837
href: ./model-driven-apps/share-embedded-canvas-app.md
836838
- name: "Embedded canvas app guidelines"

powerapps-docs/maker/model-driven-apps/embed-canvas-app-in-form.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,6 @@ For guidelines on working with embedded canvas apps as well as helpful tips to t
5353
[Overview of canvas-app connectors for PowerApps](../canvas-apps/connections-list.md) <br />
5454
[Pass the current record as data context to an embedded canvas app](pass-current-embedded-canvas-app.md) <br />
5555
[Pass a list of related records as data context to an embedded canvas app](pass-related-embedded-canvas-app.md) <br />
56+
[Perform predefined actions on the host form from within an embedded canvas app](embedded-canvas-app-actions.md) <br />
5657
[Share an embedded canvas app](share-embedded-canvas-app.md) <br />
5758
[Guidelines on working with embedded canvas apps](embedded-canvas-app-guidelines.md)
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: "Perform actions on the host form from within an embedded canvas app | MicrosoftDocs"
3+
ms.custom: ""
4+
ms.date: 03/29/2019
5+
ms.reviewer: ""
6+
ms.service: powerapps
7+
ms.suite: ""
8+
ms.tgt_pltfrm: ""
9+
ms.topic: "get-started-article"
10+
applies_to:
11+
- "Dynamics 365 (online)"
12+
- "Dynamics 365 Version 9.x"
13+
- "PowerApps"
14+
ms.assetid: 00e62904-2ce9-4730-a113-02b1fedbf22e
15+
author: "Aneesmsft"
16+
ms.author: "matp"
17+
manager: "kvivek"
18+
tags:
19+
- "PowerApps maker portal impact"
20+
search.audienceType:
21+
- maker
22+
search.app:
23+
- "PowerApps"
24+
- D365CE
25+
---
26+
# Perform predefined actions on the host form from within an embedded canvas app
27+
Embedded canvas apps provide the ability to perform predefined actions on the host form. These actions enable makers to navigate, refresh and save the host form. Using these actions, an embedded canvas app can act as a more integral part of the form and the model-driven app.
28+
29+
> [!NOTE]
30+
> This feature is currently in preview. <br />
31+
> [!INCLUDE [cc-preview-features-definition](../../includes/cc-preview-features-definition.md)]
32+
33+
The **ModelDrivenFormIntegration** object now includes the following new methods to enable makers to perform actions on the host form.
34+
35+
### NavigateToMainForm(entityName, mainFormName, recordId)
36+
Navigates the host form to a main form and displays the specified record.
37+
* **entityName** - A required string parameter that specifies the parent entity of the main form.
38+
* **formName** - A required string parameter that specifies the name of the main form to navigate to.
39+
* **recordId** - A required string parameter, that specifies the ID of the record to display in the main form.
40+
41+
Calling the NavigateToMainForm method can show the following error messages.
42+
43+
| Error message | Troubleshooting guidance |
44+
|:--------------|:-------------------------|
45+
|**Entity not found: *[EntityName]*** | Please check the value of the *entityName* parameter and ensure it is a valid entity name and that the user has access to it. |
46+
|**Form not found: *[FormName]*** | Please check the value of the *mainFormName* parameter and ensure it is a valid main form name and that the user has access to it. |
47+
|**There was a problem loading the record.** | Please check the value of the *recordId* parameter and ensure it is a valid record ID and that the user has access to it. |
48+
49+
50+
### NavigateToView(entityName, viewName)
51+
Navigates the host form to a view.
52+
* **entityName** - A required string parameter that specifies the parent entity of the view.
53+
* **viewName** - A required string parameter that specifies the name of the main form to navigate to.
54+
55+
Calling the NavigateToView method can show the following error messages.
56+
57+
| Error message | Troubleshooting guidance |
58+
|:--------------|:-------------------------|
59+
|**Entity not found: *[EntityName]*** | Please check the value of the *entityName* parameter and ensure it is a valid entity name and that the user has access to it. |
60+
|**View not found: *[ViewName]*** | Please check the value of the *viewName* parameter and ensure it is a valid view name and that the user has access to it. |
61+
62+
63+
### OpenQuickCreateForm(entityName)
64+
Opens the default quick create form for an entity.
65+
* **entityName** - A required string parameter that specifies the parent entity of the quick create form.
66+
67+
Calling the OpenQuickCreateForm method can show the following error messages.
68+
69+
| Error message | Troubleshooting guidance |
70+
|:--------------|:-------------------------|
71+
|**Entity not found: *[EntityName]*** | Please check the value of the *entityName* parameter and ensure it is a valid entity name and that the user has access to it. |
72+
73+
74+
### RefreshForm(showPrompt)
75+
Refreshes the data on the host form.
76+
* **showPrompt** - A required boolean parameter that indicates if a confirmation prompt should be displayed to the user before saving any unsaved data on the host form. Values should be "true" or "false".
77+
78+
Calling the RefreshForm method can show the following error messages.
79+
80+
| Error message | Troubleshooting guidance |
81+
|:--------------|:-------------------------|
82+
|**Please use "true" or "false" as the parameter value.** | Please check the value of the *showPrompt* parameter and ensure that it is either "true" or "false". |
83+
84+
85+
### SaveForm()
86+
Saves the data on the host form.
87+
88+
89+
> [!NOTE]
90+
> If you do not see the IntelliSense for the methods to perform predefined actions in embedded canvas apps that were created prior to the functionality being made available; save, close and re-open the app.
91+
92+
## See also
93+
[Embed a canvas app on a model-driven form](embed-canvas-app-in-form.md) <br />
94+
[Pass the current record as data context to an embedded canvas app](pass-current-embedded-canvas-app.md) <br />
95+
[Pass a list of related records as data context to an embedded canvas app](pass-related-embedded-canvas-app.md) <br />
96+
[Share an embedded canvas app](share-embedded-canvas-app.md) <br />
97+
[Guidelines on working with embedded canvas apps](embedded-canvas-app-guidelines.md)

powerapps-docs/maker/model-driven-apps/embedded-canvas-app-guidelines.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ This topic provides guidelines on working with embedded canvas apps as well as h
5555
- To directly reference the record you can use the [First function](../canvas-apps/functions/function-first-last.md). Example: First(ModelDrivenFormIntegration.Data).Name
5656
- Manually changing the App ID in the canvas app control properties is to be avoided as much as possible.
5757
- The App ID of the canvas app is automatically generated and filled in for you.
58-
- If for some reason you do need to manually edit it, you need to ensure that any App ID you use corresponds to an *embedded* canvas app and not just a standalone canvas app.
58+
- If for some reason you do need to manually edit it, you need to ensure that any App ID you use corresponds to an *embedded* canvas app and not just a standalone canvas app.
5959
- The embedded canvas app must also be created with the same data context that your model-driven form is going to send.
60-
- After you have updated the App ID select **Customize** to establish the connection to the new app.
60+
- After you have updated the App ID select **Customize** to open it in PowerApps Studio and establish the connection to the new app.
61+
- Make a small change in the app to put it in an unsaved state, then save and publish the app.
6162
- When you view a model-driven form with an embedded canvas app, if you see an error message that reads "Sorry we didn't find that app" make sure that the embedded canvas app is in the same solution as the model-driven form.
6263
- When you view a model-driven form with an embedded canvas app, if you see an error message that reads "It looks like you don’t have access to this app. Ask its owner to share it with you" make sure that the author has shared the embedded canvas app with you. More information: [Share an embedded canvas app](share-embedded-canvas-app.md).
6364

@@ -78,10 +79,12 @@ This topic provides guidelines on working with embedded canvas apps as well as h
7879
- When you create a new record, an embedded canvas app on a form is not displayed even after the record is saved.
7980
- The ModelDrivenFormIntegration.Data object currently does not work with the Display form and Edit form controls.
8081
- You can’t use the **Canvas App** privilege in a security role to grant app users access to either an embedded or standalone canvas app. For more information on sharing an embedded canvas app, please refer to: [Share an embedded canvas app](share-embedded-canvas-app.md).
81-
- If you write back the same data that is being displayed in the host model-driven form, the form will continue to display old data until it is refreshed.
82+
- If you write back the same data that is being displayed in the host model-driven form, the form will continue to display old data until it is refreshed. An easy way to do that is to use the [RefreshForm](embedded-canvas-app-actions.md) method.
83+
- If you do not see the IntelliSense for the [methods to perform predefined actions](embedded-canvas-app-actions.md) in embedded canvas apps that were created prior to the functionality being made available; save, close and re-open the app.
8284

8385
## See also
8486
[Embed a canvas app in a model-driven form](embed-canvas-app-in-form.md) <br />
8587
[Pass the current record as data context to an embedded canvas app](pass-current-embedded-canvas-app.md) <br />
8688
[Pass a list of related records as data context to an embedded canvas app](pass-related-embedded-canvas-app.md) <br />
89+
[Perform predefined actions on the host form from within an embedded canvas app](embedded-canvas-app-actions.md) <br />
8790
[Share an embedded canvas app](share-embedded-canvas-app.md)

powerapps-docs/maker/model-driven-apps/pass-current-embedded-canvas-app.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,6 @@ This topic showed you how to get started with embedding a canvas app in a model-
8181
## See also
8282
[Embed a canvas app on a model-driven form](embed-canvas-app-in-form.md) <br />
8383
[Pass a list of related records as data context to an embedded canvas app](pass-related-embedded-canvas-app.md) <br />
84+
[Perform predefined actions on the host form from within an embedded canvas app](embedded-canvas-app-actions.md) <br />
8485
[Share an embedded canvas app](share-embedded-canvas-app.md) <br />
8586
[Guidelines on working with embedded canvas apps](embedded-canvas-app-guidelines.md)

powerapps-docs/maker/model-driven-apps/pass-related-embedded-canvas-app.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,6 @@ This topic showed you how to get started with the embedding a canvas app in a mo
8181
## See also
8282
[Embed a canvas app on a model-driven form](embed-canvas-app-in-form.md) <br />
8383
[Pass the current record as data context to an embedded canvas app](pass-current-embedded-canvas-app.md) <br />
84+
[Perform predefined actions on the host form from within an embedded canvas app](embedded-canvas-app-actions.md) <br />
8485
[Share an embedded canvas app](share-embedded-canvas-app.md) <br />
8586
[Guidelines on working with embedded canvas apps](embedded-canvas-app-guidelines.md)

powerapps-docs/maker/model-driven-apps/share-embedded-canvas-app.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ Embedded canvas apps are also solution aware. By default embedded canvas apps ar
4242
[Embed a canvas app in a model-driven form](embed-canvas-app-in-form.md) <br />
4343
[Pass the current record as data context to an embedded canvas app](pass-current-embedded-canvas-app.md) <br />
4444
[Pass a list of related records as data context to an embedded canvas app](pass-related-embedded-canvas-app.md) <br />
45+
[Perform predefined actions on the host form from within an embedded canvas app](embedded-canvas-app-actions.md) <br />
4546
[Guidelines on working with embedded canvas apps](embedded-canvas-app-guidelines.md)

0 commit comments

Comments
 (0)