|
| 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) |
0 commit comments