Category Archives: Uncategorized

How to create custom connector to get the flow run history

Here are the steps to create the custom connector to get the specified flow run history in a specified environment.

Swagger file:

swagger: '2.0'
info: {title: Flow Run History, description: '', version: '1.0'}
host: us.api.flow.microsoft.com
basePath: /
schemes: [https]
consumes: []
produces: []
paths:
  /providers/Microsoft.ProcessSimple/environments/{environment_name}/flows/{flow_name}/runs:
    get:
      responses:
        default:
          description: default
          schema: {}
      summary: Get Flow Run History
      description: Get the run history of specified flow in specified environment
      operationId: GetFlowRunHistory
      x-ms-visibility: important
      parameters:
      - {name: environment_name, in: path, required: true, type: string, default: Default-82e5f1fb-9ffd-49c1-b0e1-1aae52374ff1,
        x-ms-visibility: important, description: Environment ID}
      - {name: flow_name, in: path, required: true, type: string, default: 39190573-dbe9-40a2-a99f-183bb2a3fd31,
        x-ms-visibility: important, description: Flow ID}
      - {name: api-version, in: query, required: true, type: string, default: '2016-11-01'}
definitions: {}
parameters: {}
responses: {}
securityDefinitions:
  oauth2_auth:
    type: oauth2
    flow: accessCode
    authorizationUrl: https://login.windows.net/common/oauth2/authorize
    tokenUrl: https://login.windows.net/common/oauth2/authorize
    scopes: {}
security:
- oauth2_auth: []
tags: []

Please make sure you are Adding the Activity.Read.All and Flows.Read.All permissions.

  • Next steps is to Navigate to make.powerapps.com. In the left navigation bar traverse to Dataverse->Custom Connectors and create a new custom connector (Create from blank).
  • Please provide the custom connector name and click on continue. You will be redirected to the below page.
  • In the above image you will be seeing an option called Swagger editor. Please click on it, then it will redirect you to the below page.
  • In the left side black screen, please copy and paste the swagger code which I have mentioned above. Once it is done, please click on update connector. It will navigate you to the security tab.
  • Under Authentication type, you can see the option to edit. Then please enter Client Id, Client Secret and Resource URL: https://service.flow.microsoft.com/ and click on continue. It will navigate you to the definition tab.
  • In the definition tab, you can see the GetFlowRunHistory Action as below. The request has the environment id, flow id, and api-version as input.

You can test this custom connector by passing the environment id, flow id and api version (by default value is 2016-11-01). After testing you can come outside of this custom connector and navigate to Power Automate and add this connector as a action. You will be see the below image inside your Power Automate.

Thanks for reading.

If you are interested in this topic and would like to do some further self-study, I encourage you to check out my blog on this.

How to enable Microsoft Teams integration in Dynamics 365 CE

Here is next blog on “How to enable Microsoft Teams integration in Dynamics 365 CE”

  1. Sign in as a System administrator to Common Data Service.
  2. Go to Settings > Administration > System Settings > General tab.
  3. To enable basic collaboration experience, select Yes for Enable Basic Microsoft Teams Integration.
  • 4.      To enable enhanced collaboration experience, select Yes for Enable Enhanced Microsoft Teams Integration.
    • When you select Yes to Enable Enhanced Microsoft Teams Integration, there is two consent permission popup boxes that will display. If you have a pop-up blocker and you don’t see the second consent dialog, then you need to disable the pop-up blocker in your browser.
  • On the second consent dialog box, select the checkbox for Consent on behalf of organization and then select Accept.

 Note

If you don’t select Consent on behalf of organization option, then when another user tries to pin an entity record or view to Microsoft Teams and shares the tab with another user, they will get this error message, The admin has not consented to use user sync feature, you can add them manually.

  • After the second consent is accepted select, Finish and then select OK on the System Settings screen. If you don’t select OK on the System Settings screen then you will lose your changes.

Once it is enabled, you need to install the Microsoft Teams App and set up the Microsoft Teams Collaboration Channel Tab In my upcoming post I will show you how to install and set up the Dynamics 365 in Microsoft Teams.

I hope this blog post helps you. If you are interested to know more about this topic then, I encourage you to check out my blog on this

How to enable Image for an entity in Dynamics 365 CE

Recently, I got a requirement for uploading the contractor image (pictures of contractors) to a Contactor (Custom entity).  Some OOB entities like Accounts and Contacts come with this feature enabled, but what about for other entities or custom entities?

This blog will show you how to enable image for the custom entities in Dynamics 365 CE.

  • Customizations> Customize the System > Entities > “Custom Entity” > Fields > New.
  • Provide the Display Name of the field and select Image as Data Type.
  • The Schema of the field should automatically change to entity image dynamics 365. Save and Close.
  • The Custom entity (Contractor) image dynamics 365 Main Form should now show a default image as below
  • Click on the default image, it will open the below screen.
  • Then browse and select the image you want to set
  • Select the Image and then click okay. Now your Custom Entity record should now display the entity image which you selected.

I hope this blog post helps you. If you are interested to know more on this topic then, I encourage you to check out my blog on this.

Alternate Keys as an Alternative to Duplicate Detection Rules

Recently, I came across one scenario where I shouldn’t allow the duplicate record creation.

Duplicate detection has been around since the early versions of Dynamics CRM. In 2015, alternate keys were introduced to help identify a record based on a unique combination of attributes to perform an upsert request. An upsert is the action of inserting a record if it is new, or updating it if it already exists, based on the primary key identifier (https://msdn.microsoft.com/en-us/library/dn932135.aspx). Logically, this means whenever an alternate key is defined, any new records that are created with the same key combination will throw a duplicate exception.

Note: When using Alternate Keys in this manner, be sure that the combination of attributes selected truly represents a unique value.


Setting up an alternate key(Copy pasted from MS blog):

Please follow the below steps to create the alternate Key:

1. First, navigate to System -> Customizations -> Customize the System.

2. Expand the Entity.

3. Click Keys and then New.

4. Provide a Display Name.

5.Select multiple attributes to act as a Composite, Unique key.

6. Add the selected attributes. In this instance, we chose First Name, Last Name, and Mobile Phone to be the unique keys.

Note: Only the data types of Single Line of Text, Whole Number, and Decimal Number are available for use.

7. Click OK. An indexing System Job will now be created.

That’s it! Your Composite/Alternate Key has now been created!

Now, when you create a record with the same combination as another entry in the system, you will receive the following error message as below:

Note that alternate key creation can fail sometimes. Always check, after creating your key, whether the creation has been successful. If a duplicate already exists in your dataset, the key creation will fail. To check the status of a newly created key, in your solution, navigate to Entities | <entity> | Keys and ensure the Status column states Active. If the creation fails, it shows the status as Failed.