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

Stop / Go live Lead Score Model behavior in Dynamics 365 Marketing


Recently we were writing a plugin on the Lead Score table to update the associated lead with Score and the Grade values.

The plugin was on Update of Lead Score (msdyncrm_leadscore_v2) to update lead when the Score Status = Up to date.

The interesting point we observed here was that when we stop the lead scoring model all the associated lead scoring records get deleted, which was kind of different than the usual behavior of related records, where we expect it to get deactivated/disabled.

On clicking the Stop button on the lead scoring model all the associated lead score records will get deleted.

All lead score records deleted :-

And now as soon as we Go live, the new lead score records get created back.

It starts the process of creating the records immediately.

Hope it helps..

 

Advertisements

Notification template in Omnichannel Voice (Dynamics 365 Customer Service)


Below is the default notification the agent receives on incoming conversations/calls.

It is defined through the below out-of-the-box template.

Property

Description

Title

To define the title.

Icon

To define the icon.

Show Timeout

Yes / No – to hide/show the timer (timer still runs in the background)

Time (seconds)

For the Phone Call / Voice workstream the maximum value = is 150 seconds.

Auto-assign work items

Auto-assign incoming work item

Accept Button

Specify the text of the Accept Button

Reject Button

To hide or show the button

Show desktop notification

Never / When the app is in the background

Notification Fields

Specify fields to be shown in the notification using Slugs.

To make changes in the notification, we need to create a new notification template as we cannot update the box notification template.

Navigate to Agent Experience >> Workspaces >> Notification Templates (Manage)


Here we will create a new notification template to be used in place of Voice call – incoming authenticated – default template

For our custom template, we have made the following changes –

Increased the timeout value, and changed the text for Accept and Reject buttons.

Added notification fields and enabled Desktop notification.

Let us update one of our workstreams to use this custom notification template.

Navigate to Customer Support >> Workstreams – Open the workstream and open the Advanced Settings and update the Incoming Authenticated template in the Agent notifications section.

We can see the changes reflected in the Notification.

And also in the desktop notification –

 

 

 

 

Get all the details here-

https://neilparkhurst.com/2020/06/29/omnichannel-for-customer-service-notifications/

Hope it helps..

Advertisements

Fixed – Power Virtual Agents bots for voice not working (Dynamics 365 Customer Service Omnichannel)


We can configure aa PVA Bot for workstreams and when we install the voice channel demo, we can see a bot already configured for the demo workstream.

Recently in our case, the bot configured was not working and we were getting the below message on calling the workstream/voice channel configured.

“Sorry, we couldn’t serve you at this moment. Please call back later”

On removing the bot the workstream/channel was working properly.

We raised the Microsoft support ticket for the same and were suggested to create/configure a new bot instead of using the existing demo/trial one as it might give an issue because of being configured in a different environment.

On configuring a new bot the issue got fixed for us.

Hope it helps..

Advertisements

Agents not receiving calls in Omnichannel Voice – Dynamics 365 Customer Service


Recently we saw a few of our agents were not receiving the calls/notification for incoming conversations.

Apart from checking the Routing Diagnostics, we can refer to the Omnichannel Ongoing Conversation Dashboard (available for the Omnichannel Supervisor role)

In our case, we realized that the ongoing conversation was in Wrap-up status for the agent.

And also as we had a work item limit of 1 along with assignment blocking defined through the capacity profile for that agent, the agent wasn’t receiving the incoming notifications.

So here we can ask the agent to close the session correctly.

Or as a supervisor, we can force close the conversation from the Omnichannel Ongoing Conversation Dashboard.

Force Close-

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