Archive

Posts Tagged ‘Dataverse’

[Quick Tip] Dataverse Web API | Handling special characters in Filter query

February 28, 2023 1 comment

In this quick tip, lets see how to handle special characters while querying the Dataverse Web API.

Assume that you have a Dataverse Team with name CoE&Feb&Makers as below and you would want to query the Team by ‘Team Name’ using Dataverse Web API.

Query Dataverse Web API:

  • When you hit the URL, you will get an exception that ‘The query parameter is not supported‘. This is because the team name CoE&Feb&Makers is having & symbol, which is not supported.
  • To fix this, you need to encode the team’s name. You can use online editor to encode, if you are querying the Web API from browser.
  • Now use the encoded value CoE%26Feb%26Makers in the Filter and you should get the result.

🙂

Advertisement

Dataverse | Edit system table messages (preview)

February 8, 2023 Leave a comment

As we know ‘Account’ and ‘Contact’ are system tables in Dataverse which comes out of the box, when you enabled Dataverse database on your Environment.

Why should we edit system table messages?:

  • If you change the display name for a system table, you should also update any messages that use the default display name.
  • For example, if you change the display name from Account to Company, you could still see an error message using the old name.

Lets see how to update the Messages of ‘Account’ table.

Steps to edit system table messages:

  • Sign into Power Apps (make.powerapps.com).
  • Go to Solutions, open the solution that has the table you want, and then open the table.
  • Under Solution ‘Objects’, select the ‘Account’ table and select ‘Messages’ from either of the following options.
  • Select the Message and click ‘Edit’.
  • Update the ‘Custom display text’ with the new Message text, you would like to display. Following is the explanation for each field of ‘Edit message’ pane.
  • Publish the changes.

🙂

Categories: Dataverse Tags: ,

Dataverse | Traditional Quick Find vs Enhanced Quick Find (2020 Wave 1 Update)

January 10, 2022 Leave a comment

I got a following question from a blog follower who recently started working on Dataverse on ‘Quick Find Search’.

Why the ‘Quick Find’ view not fetching the data though there are matched records?

So this article is for those who recently started working on Dataverse to differentiate Traditional vs Enhanced Quick Find view.

Traditional ‘Quick Find’:

  • Traditional ‘Quick Find’ fetches the matched rows irrespective of the current view.
  • As an example, below ‘Male Students’ view contain 2 records where Gender=Male.
  • If I search for a ‘Female’ record which is not part of this view, it will show up as below.

Enhanced Quick Find (2020 Wave 1 update):

  • With the 2020 Wave 1 update, by default ‘Quick Find’ fetches the matching records only from the currently selected view.
  • As an example, If I search for a ‘Female’ record while a ‘Male Students’ view selected, no records would be fetched. This is because of the search confined to the selected ‘Male Students’ view.

How to enable Traditional Quick Find post 2020 Wave 1 Update:

  • Post 2020 Wave 1 Update, ‘Traditional’ Quick Find will be turned off, by default.
  • To enable ‘Traditional’ Quick Find, from the Admin Center, select the Environment, go to Settings -> Features and turn on the “Use quick find view of an entity for searching on grids and sub-grids” setting.

🙂

Categories: PowerApps Tags: ,

Power BI | Dataverse | Fixing the connection reference of a report

December 31, 2021 Leave a comment

For the unversed, Using ‘Power BI embedded’ we can embed a Power BI report as Dashboard in Model Driven App.

This Dashboard can be added to a Solution and can be transported to other Environments. However there will be a challenge with report’s Connection reference.

When the Dashboard moved to another Environment, the connection will not be refreshed with Target Environment and will be still pointing to Source Environment.

As an example, if the Power BI report was built connecting to ‘DEV’ Environment, when the report exported from ‘DEV’ using Solution and imported to another Environment, reports connection will be still pointing to the Source Environment (i.e., DEV).

Workaround to refresh the Connection:

  • At the time of writing this article, there is no straight forward option to refresh the Power BI report’s Dataverse Connection.
  • One option is Save the Power BI report (i.e., .pbx file) locally and create a copy and rename.
    • In my case, I’ve renamed ‘Account_DEV’ to ‘Account_TEST’ file.
  • Open the ‘Account_TEST’ file and open the ‘Power Query Editor’ by selecting ‘Transform data’ option.
  • From the ‘APPLIED STEPS’, select ‘Source’ and update the Dataverse URL.
  • Save the report and publish to Power BI ‘Workspace’
  • Assuming you have moved the Report from ‘DEV’ to ‘TEST’ environment using the Solution, as a last step, connect to ‘TEST’ environment and select the report.
  • Click ‘Edit’ and select the ‘Account_TEST’ report from ‘TEST’ workspace.
  • This manually correcting the report’s connection works. I believe in near future we will have much easier and straightforward approach to refresh conenction.

🙂

Categories: Power BI Tags: , ,

Cloud flow | Dataverse Connector | Useful formulas and Syntaxes

September 22, 2021 Leave a comment

In this article, I am going to collate useful Syntaxes and Formulas frequently used in Cloud Flows with Dataverse connector.

Format DateTime:

When working with date and time values in flow, they may look like:

  • 2019-12-06T22:47:23.0798367Z or 2009-06-15T13:45:30Z

You may format these values to look like:

  • 6/15/2009 1:45 PM or Monday, June 15, 2009

This is done by using Date and Time Format Strings passed to the formatDateTime() function.

Example: Following is the formula to convert the ‘CreatedOn’ to ‘MM/dd/yyyy’ format.

  • ‘createdon’ has been retrieved from Flow’s ‘triggerBody()’.

Get Optionset/Choice Label:

  • By default, ‘Optionset/Choice’ field gives the Value not Label.
    • As an example, ‘Gender’ field (i.e., ‘pis_gender’) gives the ‘100000001’ not ‘Male’.
  • To get the Label, read by _{field-schema-name}_label.

Set the Lookup value:

  • To set Lookup field, in the Dataverse’s ‘Add a new row’ and ‘Update a row’ Actions, use following syntax.
    • Entity/TableName(UniqueId)
  • In below example, ‘pis_customers’ is my table name and reading ‘Customer ID’ from TriggerOutputs body.
    • pis_customers(@{triggerOutputs()?[‘body/pis_customerid’]})

Read the Dataverse ‘Trigger Name’:

  • If you have a Dataverse trigger with ‘Change type’ set as ‘Added or Modified or Deleted’.
  • Following is the statement to read the ‘Message’ (i.e., Create or Update or Delete).
    • @{triggerBody()?[‘sdkmessage’]}

Get Length of the Rows:

  • To get the Count of the records, following is the syntax:
    • @{length(outputs(‘GetAssociatedCars’)?[‘body/value’])}

🙂

Categories: Power Automate Tags: ,

Azure DevOps (ADO) | Pipeline failure | Failed to connect to Dataverse

September 16, 2021 Leave a comment

One of my ADO pipelines ‘Power Platform Publish Customizations’ task failed with “Failed to connect to Dataverse” error.

Reason:

  • ‘Power Platform Publish Customizations’ task’s ‘Authentication type’ was selected as ‘Username/password’ which does not have MFA support.
  • MFA (Multi Factor Authentication) was enabled on the Environment, which I was trying to connect from the Pipeline.
  • Since the ‘Power Platform Publish Customizations’ task’s ‘Authentication type’ was selected as ‘Username/password’ which does not support MFA, pipeline could not connect to the Dataverse environment.

Fix:

  • Create an ‘Application User’ by completing App Registration in Azure Active Directory and grant a Security Role.
  • In the ADO pipeline’s ‘Power Platform Publish Customizations’ task, select ‘Authentication type’ as ‘Service Principal’.
  • Make sure the ‘Service Connection’ configured properly with Azure App Registration details (i.e., Tenant ID, Application ID and Client Secret).
    • My connection name is ‘SP_ExpAugust21’ and details are as follows.
  • Save and run the pipeline and it should work now.

🙂

[Step by Step] Postman tool with Microsoft Dataverse Web API

July 21, 2021 3 comments

Couple of years ago, I’ve blogged Postman tool using Dynamics 365 online. In this article, lets go through the steps to connect Postman tool with Dataverse Web API.

While most of the steps are unchanged, there is a simplified way now to connect to Dataverse Web API with out the need of registering App in Azure AD. Lets get started.

Pre-requisites:

  • Power Apps Environment (Subscribe to 30 days trial, if you have not one).
  • Postman Desktop App. (Download here)
    • Note: These steps will not work with Postman web version.

Get Dataverse Environment URL:

  • Connect to Power Apps portal.
  • Select the ‘Environment’ you wish to connect from Postman tool.
  • Click on ‘Settings -> Advanced Settings’
  • Copy the URL up to the ‘dynamics.com/’ from the new window as shown below.
  • Add ‘.api’ before ‘.crm.dynamics.com’ to the URL.
  • Copy and Save this URL, which would be used in next steps.

Set up Postman Environment:

We would need ‘Workspace’ and ‘Environment’ to get started with Postman.

  • Open the Postman tool and create a new ‘Workspace’ if not having already.
  • Click on create a new ‘Environment’.
  • In the ‘Add Environment’ screen, we need to add Variables related to ‘Dataverse’ which helps Postman to connect Dataverse Web API.
  • Following 6 variables need to be configured.
Variable reference diagram
  • Lets add the first Variable “url“. In the ‘INITIAL VALUE’ paste the Dataverse environment url copied in previous section.
  • Repeat the step for next 5 variables and looks as below. Click ‘Add’ to save the Postman ‘Environment’.

Authorize Postman to Dataverse Environment:

Now that we have Postman Environment ready with required variables. Lets authorize and connect the Postman to Dataverse Web API. For that we need to complete ‘Authorization‘ and generate a new ‘Access Token’.

  • Select to the new Postman ‘Environment’ created in previous section.
  • Create a new GET ‘Request’ and select {{webapiurl}} variable as url.
  • Click on ‘Authorization’ tab and select ‘TYPE’ as ‘OAuth 2.0’ and click on ‘Get New Access Token’.
  • Provide details as below in the ‘Get New Access Token’ screen and click ‘Request Token’.
  • In the next screen, provide the Office 365 credentials.
  • Post successful authentication, a new ‘Access Token’ gets generated as below. Click ‘Use Token’.
  • ‘Access Token’ expires every 1 hour and you would get “401 Unauthorized’ exception upon expiry.
  • Click on ‘Get New Access Token’ if the Token expires to get a new Access Token. From 2nd time, Token generates instantly without any further sign-in.

Connect Postman to Dataverse Web API and query:

As we completed ‘Authorization’ and got the ‘Access Token’, we are good to query Dataverse API.

  • Create a new GET ‘Request’ and select {{webapiurl}} variable as url.
  • In the ‘Authorization’ tab, select the ‘Access Token’ generated and click ‘Send’.
  • You should get the Response as below with 200 Status code.
  • Below is the sample to fetch Top 3 Account records.

🙂

Canvas App | Dataverse | Distribute columns to multiple forms and Patch

January 18, 2021 Leave a comment

When working with large tables in Canvas App’s Phone layout Forms, it would be counterintuitive to place all the fields in a single form. In below screen, user has to scroll a lot to fill all the details.

In this article, lets see how we can simplify above screen by distributing fields in multiple forms and finally use the Patch function to save the information in to Dataverse from all the forms.

I am taking the OOB ‘Contact’ table in this scenario and distributing fields in to 3 screens (i.e., Basic Details, Contact Details and Additional Details). Lets get started.

  • Create a new Canvas App from Maker portal.
  • From the ‘Data’ tab, Select ‘Entities -> Current environment -> Contacts’ table and add to the App.
  • Add 3 screens (Basic Details, Contact Details and Additional Details) to distribute fields.
  • In the Basic Details screen (i.e., scrBasicDetails), add a new Form (i.e.,formBasicInfo) and add following fields from ‘Contact’ Datasource.
  • Add a Button, to navigate to next screen (i.e., scrContactDetails). Add following formula on ‘OnSelect’ of button.
  • Similarly, In the Contact Details screen (i.e., scrContactDetails) add a new Form (i.e.,formContactDetails) and add following fields from ‘Contact’ Datasource.
  • Add a Button, to navigate to next screen (i.e., scrAddlDetails) by triggering ‘Navigate’ function on ‘OnSelect’ of button.
  • In the last ‘Additional Details’ (i.e., scrAddlDetails) screen, add a new Form (i.e.,formAddlDetails) and add ‘Attachments’ field to capture and store documents to Dataverse.
  • Since this is our final screen, Add a Button to Submit the data to Contact table in Dataverse using following ‘Patch’ function.
  • Post submit refresh the forms using NewForm() function.
  • Display a banner message using ‘Notify’ function.
  • Finally Navigate back to first screen (i.e., scrBasicDetails) using Navigate() function.
  • Combined formula is as below.
// Patch : Use Patch with the Defaults function to create records.
// form.Updates : Gets the data from the fields presented on the from.
Patch(
    Contacts,
    Defaults(Contacts),
    formBasicInfo.Updates,
    formContactDetails.Updates,
    formAddlDetails.Updates
);
// NewForm : Sets the form mode to Insert so that you can submit a new Contact.
NewForm(formBasicInfo);
NewForm(formContactDetails);
NewForm(formAddlDetails);
// Notify : Display notification
Notify(
    "Contact submitted successfully",
    NotificationType.Success
);
// Navigate : Navigates to first screen
Navigate(scrBasicDetails);
  • Run the App, provide details and navigate to next screen and upload images and finally click ‘Submit’ to save data to Dataverse.
Combined screenshot of 3 forms
  • Now go to Dataverse using Model Driven App and open the Contact -> Audit History, to prove only one transaction triggered with our Patch function.

🙂

Categories: PowerApps Tags: , , ,