Breaking news from around the world
Get the Bing + MSN extension
Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, PowerApps, Microsoft Flow, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates to Dynamics 365Release overview guides and videos Release Plan | Early Access Availability
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
Have you ever had that requirement where you know you can solve most of it with a workflow but the information you are after is one relationship too far away? For example:I have a custom entity called Event Registration that is related to Contact but the discount information is placed on Account. This article will explain how you can use an action as a placeholder for that information that is out of reach, and use it in your workflow either as a condition or to populate a field.
At the end of January I was one of the speakers at D365 Saturday Scotland where I did a session I called “No-code Hacks”. My presentation was a live demonstration where I did no-code configuration solving a couple of fairly complex requirement. This action-hack I’m about to go through in this article is one of those hacks, a hack I first learnt from my very talented colleague Stina Persson, so big thanks to Stina!
We have two custom entities, Event and Event Registration. We have a field on Account called Event discount that we want to check if it contains data, and if so, populate the Event Registration with that information.
So as for now we can’t use information on Account in a workflow that triggers on Event Registration. So let’s create the action that solves that problem!
First I create an action on the Contact entity and add a process argument with the following information:Type: EntityReferenceEntity: AccountDirection: Output
So next step is to define which relationship between Account and Contact I want to receive when I run my action. In my scenario I only have one relationship, the default one, so it’s an easy decision but other scenarios might very well contain several options so be careful with what you choose here.
First I add the Assign Value step in my action (1) and define the value as the dynamic value of Company name(2).
All done! Now I just activate my action so I can use it my workflow.
To start with I create a real-time workflow that triggers on create of Event Registration. Since the first thing I want to do is check if the participant’s (Contact) are entitled to an event discount I start with running my action so I can use Account information in my condition
In properties for the action I define what relationship between Event Registration and Contact I want to get the Account for.
Now I can add my condition (1) and find my action in Local Values (2) and there after use any field on the Account entity in my condition (3).
Next step is to update my Event Registration with the discount information. Same thing here – I have a Local value that refers to my action information that I can use to populate my discount field. Awesome!
What was that? Using an action in an action in a workflow? Well what if we need to reach another entity that is one step even further away? Let’s say that if the Parent Account of the Account have a discount, that should override the other discount. How would that look? Let’s check it out!
First of all – let’s create a similar action to the previous one that retrieves the Parent Account. I create my action on the Account entity (1), add the process argument (2), add the assign value step (3) and make sure to pick the right relationship to retrieve (4).
Now I need to make some changes to my workflow. First I remove my condition (since we’re going to change it anyways), then I perform my second action straight after the first one (2). When I set the properties of the “Get Parent Account”-action I use my local value to make sure I retrieve the Parent Account from the Account I retrieved in my first one.
So finally in my condition I first check for if the Account have a Parent Account and that Parent Account’s Discount field contains data (1), if so update the Event Registration with the Discount from Parent Account (2). If not check if Account’s Discount field contains data, if so update the Event Registration with the Discount from Account.
There you go peeps! That’s it! So no need for unnecessary relationships between entities (or god forbid – CODE) to solve issues like this. Actions are the way to go! Also remember that these actions are re-usable for when ever you need to get that relationship again.
Business Applications communities