How to Set a Lookup Field to Another Lookup Field on a Dynamics 365 Power Apps Form using JavaScript

There may be cases where you need to set a lookup field on a Dynamics 365 / Power Apps form, where you want to default the value to another lookup on the form using JavaScript to default the field value. For example, on the Account form, we have the owner of the account (field OwnerId), and we have a custom field called My System User Field (new_mysystemuserfield) which is a … Continue reading How to Set a Lookup Field to Another Lookup Field on a Dynamics 365 Power Apps Form using JavaScript

Refreshing a Web Resource in Unified Interface with JavaScript (The New Way)

This post comes from a great find courtesy of an elite dev I work with who goes by “PV”. We had a requirement to reload / refresh an HTML web resource on a page when a user clicked into a tab to view it. This used to be reasonably straight forward in previous D365 versions and JavaScript – get the Web Resource using getSrc, set the Web Resource to null … Continue reading Refreshing a Web Resource in Unified Interface with JavaScript (The New Way)

Run JavaScript When User Clicks On Unified Interface Tab

In Dynamics 365 / Power App, we may want to “do something” when a user clicks on a form tab. Let’s look at how we can write a handler to invoke custom code. In our example, let’s look at the Account form. This form has multiple tabs – Summary, Project Price Lists, General etc. Let’s write code so when a user clicks in and out of the General tab, our … Continue reading Run JavaScript When User Clicks On Unified Interface Tab

How to Pass Parameters to a Button in Power Apps Dynamics 365

In this post, we will look at how to add a button to a Dynamics 365 Power Apps Form that receives parameter data. First, let’s look at passing context. Create a new JavaScript web resource and add it to the Account form. We will add the sample code below, which takes PrimaryControl as the first parameter, and if the name of the account is Contoso, sets the website field: You … Continue reading How to Pass Parameters to a Button in Power Apps Dynamics 365

Using Calendar Control in Dynamics 365 Power Apps Dashboard Components

In this post, we will look at how to use the Calendar Control in Dynamics 365 Power Apps Dashboard Components. Let’s start with a dashboard we created earlier, which shows an editable grid of accounts: Now, this view has one field, Last Date Included In Campaign, which is a date field. If we click on it, it displays a calendar for the user to select a date: But what if we … Continue reading Using Calendar Control in Dynamics 365 Power Apps Dashboard Components

Creating a System Dashboard in Dynamics 365

To create a system dashboard, go to the Power Apps Maker and create a new solution: Then select New->Dashboard and select the type of dashboard: We will select 2-column overview: Give the dashboard a name: And we will add a list to the first component: It will be a list of all Accounts: Click Save: If I don’t publish, we can see the Dashboard under Dashboards, however we see the … Continue reading Creating a System Dashboard in Dynamics 365

Using Editable Subgrids in Dynamics 365 Dashboards

In this post, we will look at using editable subgrids in a Dynamics 365 Power Apps dashboard. Let’s say you have a dashboard called System Accounts Dashboard. In this dashboard you have a list of Accounts: Go to the Power Apps maker and edit the dashboard to take a look at it: Select the list component and click Edit: This opens the Properties tab. Click on the Controls tab: We … Continue reading Using Editable Subgrids in Dynamics 365 Dashboards

How to Remove the Border around a Web Resource in Dynamics 365 / Power Apps

When a web resource is created in Dynamics 365 / Power Apps, we get a border defaulting around it. For example, below is a web resource on the Account form displaying “Hello World”. We see the border around the web resource: Even though we’re not doing anything specific in the web resource HTML: To remove the border, open the form in design mode and go to the Web Resource properties: … Continue reading How to Remove the Border around a Web Resource in Dynamics 365 / Power Apps

Retrieving Entity Metadata in Dynamics 365 with JavaScript

In this post, we will look at how to retrieve Entity Metadata in Dynamics 365 with JavaScript. Let’s say you want to get the metadata for an entity. Running this, we get: Let’s say you want to retrieve all attributes for a given entity, We will do this for the account entity. The code: Running this, we get: For more information, check out here.

Showing an Error through JavaScript in Power Apps and Dynamics 365

When customizing model-driven Power Apps and Dynamics 365 with JavaScript, you may need to display an error to the user. One way to do this is to use Xrm.Navigation.openErrorDialog, which is called like below: Xrm.Navigation.openErrorDialog(errorOptions).then(successCallback,errorCallback); Let’s run it in browser Development Tools to show how it works. Open a Power App and in dev tools add the following code: Xrm.Navigation.openErrorDialog({ errorCode:”ABC7123″, details:”These are the details that will go into the … Continue reading Showing an Error through JavaScript in Power Apps and Dynamics 365