How to use Customer-field in Power automate
In one of the projects I am working a the moment, we do use an custom activity on the case entity. Last week I had the requirement to create an automated name for this entity. Which is a quite common requirement. In this case the name should be composed out of customer name, Case subject and the current date and time.
I thought it would be a perfect useCase for a Power Automate flow.
While creating the flow I actually had some problems getting the customer from the “Customer-Field” of the case entity. The “Customer-Field” always is a bit tricky, since it could contain an contact or an account. I talked about it with Sara Lagerquist (she is my flow questions, go-to person ). After a bit of discussion, she came up with the solution. Thanks for that!
Problem
I created a trigger “onCreate” of our custom “Demo” entity. The first step was to load the related case entity and filter it on “title” and “customerid”.
Unfortunately, this resulted in an error that Power Automate is unable to find the property “customerid”.
The whole error message:
{ "message": "Could not find a property named 'customerid' on type 'Microsoft.Dynamics.CRM.incident'.", }]Solution
There is actually a very simple solution. It is to filter on “_customerid_value”.
After that, it is possible to add a split based on the entity type in the “Customer-Field” do either load an contact or an account.
Important to mention is, that you have to create the split before you actually filter the case. Only then it is possible to choose the “Customer (Type)” as a condition.
After filtering the “Get Record” the condition will be changed to a not very user-friendly expression. But it is still working. Until now I was not able to recreate the condition manually.
Complete Flow
And here is the complete flow to set the correct name.
I would like to point out the step that generates the time. It is a “convert time zone” action, which converts the time from UTC to UTC+1. The reason for that is that I am located in Stockholm and the servers are located in Ireland (as far as I know). You could also generate it with an expression in an compose action. But in this case it will not convert the time zone like i need it.
Thanks again to Sara for the right solution!
The post How to use Customer-field in Power automate appeared first on Benedikt's Power Platform Blog.
This was originally posted here.
*This post is locked for comments