Tag Archive for: Howto

Dynamics 365 Sales is a cloud-based CRM solution that enables salespeople to build strong relationships with their customers, take actions based on insights, and close deals faster. With Dynamics 365 you can manage your customer relationships, from first contact (lead) to qualifying (opportunity) to deal (Quote/Order).

Dynamics 365 can be used by Microsoft Power Automate to automate almost anything within Dynamics 365. Dynamics 365 and Power Automate together, make a great combination for further enhancement of your sales process.

In this example we will teach you how to use Power Automate to send a message to your sales staff via Microsoft Teams when a new lead has been assigned to them in Dynamics 365.

Step 1: Create new Power Automate Flow

Go to https://make.powerautomate.com/ and click on “Create”, and select “Automated Flow”

Step 2: Enter Flow name and select Dataverse

Give the flow a name, and search for “dataverse” and select “When a row is added, modified or deleted”

Step 3: Configure Trigger that will start up our Flow

On the next screen we will configure the trigger. We will configure the Change Type to “added or modified” to ensure that the trigger only runs when a new lead is added, or when a lead is modified.

Table name: Leads (as we want to target leads in this case)

Scope: Organization (We want this flow to run for the entire dataverse organization, not just our user scope)

Select Columns: We will enter “ownerid” here because we want to make sure that our trigger only runs when the field “ownerid” (which is the lead owner) is added or changed

Step 4: Get Current Lead

First we need to get the record of the lead that had an addition/change to the lead owner. We will add a new action to our flow and search for “dataverse” and select “get a row by ID”

We will select the table name “Leads” and for Row ID we will select “lead ID”

Step 5: Ignore Closed Leads

To make sure we’re not going to process leads that have been closed already, we need to filter out the closed leads with a condition. We can do that by terminating the flow if the “Lead Status” is equal to 0.

 

Step 6: Get Lead Owner

For the leads that are not closed, we continue by getting the lead owner from the relationship between table “leads” and “users”. We can do that by retrieving the Table “Users” and get the row id from the Owner Value from the Leads.

Step 7: Get Lead Owner Email Address

Since we want to send a teams message, we will need to retrieve the primary account UPN for that particular owner. We can do that by creating an action called “Get user profile (V2)”, and search the user based on the primary email address we got from the previous step.

Step 8: Get a Mention token for a user in Teams

Since we want to send a message in a particular channel, and tag the owner in the message, we need to get a “mention token” for this user. We can do this with the task “Get an @mention token for a user” from Teams, and use the user principal name we got from the previous step:

Step 9: Delay task for 1 Minute

In order to make sure that Teams is ready to accept our message with mention token, it is recommended to add a 1 minute delay, to make sure no errors occur:

Step 10: Post a Message in a Chat or Channel

Now we have all the information we need, we can post a message in a Teams Channel. In our case we post it in a group chat, but you can also choose a channel.

For the message, we will include not only the Lead Company Name and Lead Topic, but we also want to include a link to the actual lead in dynamics.

Make sure that you enter the fields using the Code View “</>” option, so your urls will not be truncated or broken. In the Code View option, you can enter HTML code to change the layout of the text. (We use <p> for paragraphs, <br> for lines etc

You can see from above screenshot, we first add the “mention token” and then we also include a link to the URL of the lead in Dynamics.

How to get the Lead URL in Dynamics:

  1. Go to Dynamics 365 – Leads
  2. Click on any Lead
  3. Extract the URL from your browser, and remove the last guid from the url (see orange below)

The URL you should use should looks something like:

https://xxxxxxxxxxxxx.dynamics.com/main.aspx?appid=xxxxxx&pagetype=entityrecord&etn=lead&id=

Now paste that in your Flow and make it a Link using the html <a href=””>  lead </a> code.

When you’re done, your flow should have the following steps:

Now you can test your flow, and (hopefully) it should work. Here is an example of how it looks on our side:

Great Work! Feel free to reach out if you have any issues or questions regarding above flow.

Microsoft Power Automate (earlier known as Microsoft Flow) allows you to automate repetitive manual tasks and paper processes via an easy to use drag-and-drop wizard.

Microsoft Power Automate can create workflows to sync data across apps and software, generate real-time notifications to alert stakeholders, update databases with new information and collect data from Power Apps or other data sources.

In this example we will teach you how to use Power Automate to create recurring tasks in Microsoft Planner.

For this example we imagine that we want to remind our finance department to check and send out a monthly invoice to the customer.

Step 1: Create new Power Automate Flow

Go to https://make.powerautomate.com/ and click on “Create”, and select “Scheduled Cloud Flow”

Step 2: Enter Flow Name and Set Schedule

Give the flow a name, and enter the schedule. In our example we want to have a monthly reminder, so we set the repeat time to every 1 month.

Now we can see the Flow editor screen, with our monthly recurring task as starting point. We click on new step:

Step 3: Create New Task in Planner

We find Planner and select “Create a Task”

After that we select which Planner Plan the task need to be created, and we fill in the information that we want to show in the planner task.

In our example we want to enter some dynamic fields, for the Start Date, Due Date and also to show a dynamic date and time in the Title.

For the Start Date we want today’s date, so we will have to fill in a Dynamic Expression:

Expression:

utcNow()

For the Due Date, we want to set it 15 days from today, hence we fill use the expression adddays() to add 15 days from today (utcnow()):

For the Title we also want to add the Due date, hence we will add the adddays function as well there:

Expression 1:

formatDateTime(adddays(utcnow(),-15),'MM')

Expression 2:

formatDateTime(utcNow(),'yyyy')

Important: For Assigned User Id’s, fill in the email addresses of the users that you want to assign the task to.

Step 4: Update Planner Task Details

Now we have created the main task, we can also update or add more details under the planner task details. For this we add one more flow called “Update task details””.

In this task, we need to refer to our original planner task ID.

 

And after that we can add some more information. In our case we add a link to the billing sheet we want the finance department to use, which is an Excel file. But you Can also add a checklist here.

That’s it! Now our Flow is ready. We can save it, enable it and test it out. If everything runs smooth, your task will now appear in Microsoft Planner every month.