Auto-create SharePoint Folder (SharePoint Document Location) on record create using Power Automate Flow (Dataverse)


We recently had a requirement to create the SharePoint folder automatically on the Account records creation, instead of having the users click on the Documents tab to create it.

We could write a Power Automate flow to achieve this.

Here we have enabled the Share Point server-based integration. Also, the SharePoint Site and the main or parent folder for the Account are already created/configured.

Below is the corresponding Document location record for the parent Account folder.

  • So basically, we will create a new folder inside the Account folder in the SharePoint site configured in CRM.
  • Then create a new SharePoint Document Location record specifying the Account document location as a parent.
  • And then Associate / Relate the new account record created with this new document location record.

Below is how our Flow will look like –

  1. Triggers on Account record creation.

2. Create a new folder inside Account Folder, here for the name of the folder we are using the format “AccountName_AccountNumber

3. Create a new Document Location record, associating the Account document location with the parent location record. Here we are specifying the same folder name in the relative URL.

We can also fetch the GUID of the Account document location and/or use a variable to store the GUID.

4. Lastly, we are associating these 2 new records.

Below is our newly created account record.

Below we can see our flow ran successfully.

We can see the new folder created and associated.

Here if we click the Documents tab immediately after creating the account record, before our flow runs, we might have the OOB folder also getting created along with our custom folder (flow being asynchronous). If our custom folder is already created and associated before the user clicks on the documents tab, then CRM will not be creating a new folder.

Hope it helps..

Advertisements

Using IntelliSense with Kupp Code Analytics


In the previous posts, we covered the Key Features and Capabilities of Kupp Code Analytics and the Installation and Setup of the Visual Studio Extension.

In this blog post, we’ll cover one of its key features – IntelliSense.

As we saw in the last post the Kupp Analytics tool will download and cache the Metadata of the environment it is configured to, which it uses for IntelliSense.

To refresh the Metadata cache, or configure and manage the connection, navigate to Extensions >> Kupp Code Analytics >> Connection

Let us look at different places where we get the IntelliSense.

Starting with the entity or table, we can see it suggesting all the tables in that Environment.

If we have specified the entity name, when it comes to attributes or columns, we can see it suggesting all the attributes specific to that table.

Getting attributes with specific type lists only attributes having the same type.

For EntityReference – we can see it suggesting all the lookup fields.

Same for Money

And for OptionSetValue

It also suggests the attribute’s value in the case of Option Sets

IntelliSense also applies to Relationships, we can see it suggesting only contact-related relationships.

Apart from our Plugin and Console Applications (C#), we have the Intellisense feature available for our client-side code as well (JS/TS).

To configure we can navigate to Options >> Kupp Code Analytics >> General

Currently, the IntelliSense support is limited to retrieve operation only.

It suggests,

the name of the entity –

different query options

attributes specific to the entity –

Filter
operators

Query
functions

Thus using the IntelliSense feature that provides real-time suggestions, the development team can code efficiently, reduce typing errors, develop faster, and maintain code consistency.

Get all the details here –

https://docs.kuppsoft.com/Kupp-Code-Analytics/CA-Reference/CA-IntelliSense-(.NET)

https://docs.kuppsoft.com/Kupp-Code-Analytics/CA-Reference/CA-OData-IntelliSense

Hope it helps..

Advertisements

How to – Upload a file by URL to SharePoint (Power Automate / Dataverse)


Recently we had a requirement to upload a document (pdf) to a SharePoint folder.

We had the URL of the field saved in one of the fields of the Contact table in Dynamics 365 / Dataverse.

Below is our field and the URL in it. (the URL points to the Manual of Fulla 2, one among many awesome products by Schiit)

Below is how our flow looks like

Here we already have Server-Based SharePoint integration enabled. https://nishantrana.me/2023/07/28/based-on-entity-behavior-for-sharepoint-folder-dynamics-365-dataverse/

The flow triggers when there is an update in the File URL field of the contact record.

Next, we are using HTTP action to use the GET method to get the content of the file. As it is a public URL we haven’t specified any Authentication.

Next, we are using Create File action of SharePoint, we have specified the Site Address, Folder Path, File Name, and most importantly the Body of the HTTP action to the File Content property.

On the successful run of the flow,

we can see the document (pdf) uploaded in the SharePoint folder.

Hope it helps..

Advertisements

Trying out – CreateMultiple bulk operation message (Preview) in Dataverse (Dynamics 365)


As we know now we have the bulk operation messages – CreateMultiple, UpdateMutiple, and DeleteMultiple (only for elastic tables) released with UpsertMutilple coming soon.

The messages allow us to work with records in bulk. Get more details here

And in fact, now we can also write plugins against the CreateMultiple and UpdateMultiple messages. Get more details here

These messages are available for all the custom tables, but not all the standard tables.

To check availability with standard tables

<fetch>
  <entity name="sdkmessagefilter">
    <attribute name="primaryobjecttypecode" />
    <link-entity name="sdkmessage" from="sdkmessageid" to="sdkmessageid" link-type="inner">
      <filter>
        <condition attribute="name" operator="eq" value="CreateMultiple" />
      </filter>
    </link-entity>
  </entity>
</fetch>

Just to quickly try it out, we created 1000 contact records one by one and then used the CreateMultipleRequest in bulk.

We got the time-out error.

Same error message while working with 500 and then 200 records.

Finally, we got success with 100 records.

We should use the bulk message in multiple parallel threads under different application users to improve the performance – https://nishantrana.me/2021/06/08/data-migration-optimum-batch-size-and-threads-for-maximum-throughput-microsoft-dataverse-dynamics-365/

Hope it helps..

Advertisements

Date Time Fields (Date Only and User Local – Behaviour) in Power Automate (Dataverse)


Recently we faced an issue in our flow that was showing a different date that the date entered by the user for a date time field.

Let us look at the below scenario to understand it.

Say we have the below field Date and Time with Time Zone Adjustment as User Local created in CRM / Dataverse.

Now user enters the below value in in the field and saves the record which triggers the flow.

The user’s time zone is set as below

Now in our Power Automate flow, we can see the UTC date for it.

2023-08-27T20:00:00Z

Now to convert to the user’s New Zealand Time Zone we can make use convertTimeZone function here

convertTimeZone(triggerOutputs()?[‘body/cr0e8_mydatetimefield’],’UTC’, ‘New Zealand Standard Time’, ‘MM/dd/yyyy’)

We get the date as expected i.e. 28th

Now let us change the Format of the field to Date Only, and we keep the Time zone adjustment as User Local only.

Let us trigger the flow again. (now we don’t have the time part)

We get the date without time part as expected.

But this time the convertTimeZone
function doesn’t work, as we only have the Date part and it is not in the UTC format.

convertTimeZone(triggerOutputs()?[‘body/cr0e8_mydatetimefield’],’UTC’, ‘New Zealand Standard Time’, ‘MM/dd/yyyy’)


Check this thread that talks about it –

https://powerusers.microsoft.com/t5/Building-Flows/Dataverse-Date-only-field-is-set-1-day-off-from-original-value/td-p/805859

Here one quick fix could be to change the Time zone adjustment to Date Only or Time zone independent for that field(i.e. no time zone conversion).

https://learn.microsoft.com/en-us/power-apps/maker/data-platform/behavior-format-date-time-field#date-and-time-column-behavior-and-format

Now triggering the flow again, we get the below values –

as now there is no time zone conversion for that field.

Hope it helps..

Advertisements

Fixed – The ‘CreateMultiple’ method does not support entities of type ‘none’. MessageProcessorCache returned MessageProcessor.Empty in Dataverse / Dynamics 365


Recently while trying to use the new CreateMutipleRequest message we got the below error –

“The ‘CreateMultiple’ method does not support entities of type ‘none’. MessageProcessorCache returned MessageProcessor.Empty”

It was because we were not populating the EntityName property of EntityCollection class. Specifying it fixed the issue.

Hope it helps..

Advertisements