Get RequiredAttendee (Required) from the Meeting (appointment) table – Power Automate / Dataverse


Below is the sample flow we can use to retrieve the Required (requiredattendees) field’s value from the Meeting table (on the update of the record).

Here we are triggering the flow, if there is an update in the subject field of the meeting record.

Then using the List rows action we are fetching the Activity Parties record associated using the Appointment’s unique identifier and participation mask as 5.

More on participation type mask

And in the last step, we are checking for all the associated Activity Party GUIDs for a specific GUID and then update the record or cancel the record.

Hope it helps..

Advertisements
Advertisement

Filter rows using contains, startswith and endwith Power Automate – Dataverse


Recently in one of our projects, we were using the Microsoft Bookings App for the users to book an appointment(outlook) and then were syncing this appointment back to Dynamics 365 through the category “Tracked to Dynamics 365” (Server Side Synchronization)

Get more details on it here – https://nishantrana.me/2022/03/22/how-to-synchronize-appointments-between-dynamics-365-and-outlook-using-server-side-synchronization/

Here if the users were canceling the tracked appointment in Outlook, it will update the subject of the appointment record with the prefix – Canceled but will not cancel the record i.e. update the status of the record.

This would happen if the user canceling the appointment is not the organizer.

https://learn.microsoft.com/en-us/power-platform/admin/sync-logic#syncing-canceled-and-deleted-appointments-from-exchange-to-dynamics-365

So here we were implementing a flow to check for updates in the Subject column with the word canceled and then updating the status of the appointment as canceled.

Here we can specify our select columns and filter conditions as follows – contains

Or startswith

https://learn.microsoft.com/en-us/power-apps/developer/data-platform/webapi/query-data-web-api#standard-query-functions

Hope it helps..

Advertisements

How to – Create Marketing form submission record through Flow (Power Automate) – Dynamics 365 Marketing


Recently we were exploring the possibility of creating a marketing form submission record through flow/custom code. Here simply creating the marketing form submission record is not enough, for it to be processed by the platform, we need to call the bound action – msdyncrm_UpdateMarketingFormSubmission with Step = Retry. (And it’s all not an officially supported scenario, so be careful)

Below is how the flow looks like

First, we create a form submission record –

After creating the form submission record, we are creating and associating the marketing field submission records with the values that we want to pass for the form – email, first name, and last name in this case.

And then eventually calling the action –msdyncrm_UpdateMarketingFormSubmission to trigger the submission (resubmit) of the form submission record.

On running the flow, we can see the record created with the status as pending.

Within a few seconds, if the input is correct, we can see the status updated as success

and the corresponding contact/lead created or updated.

Hope it helps..

Advertisements

Using addProperty to dynamically add a custom property to a JSON object – Power Automate


Recently while working on the integration of Facebook Lead Ads with CRM, through Webhooks / Power Automate we had to process the lead data and create lead and contact records.

Below is a sample format in which we’d get the lead data for the FB form having a first name, last name, date of birth, and email fields in it.

Now we want to create an object having name as proprety and value from values like below from the above response, which will make it easy for use to refer in add a new row / update a row Dataverse step.

For this we will be using addProperty function.

Below is our sample flow –

First we are initializing varJSON – string variable with the JSON response

Than intializing the another variable varFieldData as type Object

Parse JSON action using the sample response.

Here we are interested in field_data property

So in the next step, we loop through each field_data, than use addProperty function in Compose to add name and value to the varFieldData object, and use the outputs of compose to set the varFieldData variable.

addProperty function – addProperty(variables(‘myObject’), ‘newProperty’, ‘propertyValue’)

In the next step, we can see the varFieldData and the way we can access the property last_name added to it.

On running the flow we can see the result as expected –

Hope it helps..

Advertisements

List Rows, Select Columns, and Lookup field – Power Automate / Dataverse


Suppose we want to retrieve the value of the source campaign lookup of the lead records.

The schema name of Source Campaign is – campaignid

To get its GUID in the Select columns of list rows we can specify it as

_campaignid_value i.e. _lookupschemaname_value

The other option is if we specify the schema name in select columns then we need to use the expand property to get the GUID as well if we want any other attribute values e.g. text/label of the lookup field.


Hope it helps..

Advertisements

Using Coalesce Function to handle null value in Power Automate – Dataverse


Recently in one of our flows, we were getting the below error –

InvalidTemplate. Unable to process template language expressions in action ‘List_rows_:_Region’ inputs at line ‘0’ and column ‘0’: ‘The template language function ‘replace’ expects its first parameter ‘string’ to be a string. The provided value is of type ‘Null’. Please see https://aka.ms/logicexpressions#replace for usage details.’.

One or more fields provided is of type ‘Null’, a different type is expected.

This was because the replace function that we were using for the Filter rows property of List Rows (Dataverse) had the variable value as null.

Below was our dynamics expression where we replaced apostrophe with 2 single quotes – https://nishantrana.me/2023/02/27/how-to-handle-single-quote-apostrophe-in-filter-rows-in-power-automate-dataverse/

replace(replace(variables(‘varFieldData’)?[‘myVariable’],‘_’,’ ‘),””,”””)

The solution was to use coalesce function, to replace null with a blank string as shown below.

replace(replace(coalesce(variables(‘varFieldData’)?[‘myVariable’],”),‘_’,’ ‘),””,”””)

Similarly, we can use coalesce function to provide a default value.

The coalesce function will evaluate its arguments in order and will return the first non-blank or non-empty value. If all the arguments are blank or empty strings, the function will return blank.

After using the coalesce function, our flow was successful.

More on COALESCE

A similar example in SQL –

Hope it helps..

Advertisements
%d bloggers like this: