This is a relatively simple request: I need my record name to follow a specific standard.
Let’s look at a scenario: I have records created into my CDM through automation. Let’s look at Orders, but this could be based on any other record type.
When creating new Order records, part of the data flowing into my system includes the Account the Order belongs to, as well as an Account that will be invoiced for these Orders. Imagine a scenario with a large organization, with multiple locations. Orders are fulfilled for each location, but all billing goes to the main office.
This was achieved in the past either by calculating and generating the Order name directly in the transformation done by the integration tool, or through a plugin. If records were created manually, you could also do this on the client side, using scripting. Since these records are created automatically, there is no client side code run, so you’re really stuck with most likely a plugin.
Now, we can also do this easily using a Flow. Let’s see how that’s created.
Start by navigating to flow.microsoft.com and login with an account that has access to this environment. Select from the Environments drop-down the correct environment where you want this Flow to execute.
As an added bonus, now Flows can be part of a solution, so if you have a solution in place, select solutions from the left side navigation, and open the Solution that will include this Flow. Alternatively, you can build this Flow, and add it to a Solution later on. Best practice is to include your Flows in a solution, so, whichever way you create your Flow, make sure it gets added to a Solution.
Select New from the top ribbon, and choose Automated – from Blank, as seen below.
Give your Flow a meaningful name, and in the trigger search for Common Data Service. Choose When a record is created, as seen below.
Select Create. You are taken to the Flow editor, and the first step is already populated. Fill in the require fields as seen below.
My current environment is ntdemo15 (a trial environment), and I chose to setup the scope to Organization. Add a new step.
Now we need two Get record steps to retrieve the two Order and Invoice accounts. Let’s first get the Order Account (Customer).
Similarly, let’s get the Invoice Account also, as seen below.
Finally, add the Update a record action, and fill in the required fields. Environment and Entity Name remain the same as the previous step, but in the Record identifier, select the Order Id (Order) from the previous When a record is created step. This points us back to the record that triggered this action to update the name.
See the screenshot below.
In the name field, I want to concatenate first the date and time of when the process is run (you could also use the record created date and time if you want), along with the Invoice Account name and the Customer (Order Account) name. You do this by using the Expression for the data/time as well as the Dynamics content for the existing record values.
When selecting the Dynamics content, you will observe the separate headers for the two Get record steps we added earlier, as shown below.
Make sure you select the correct Account Name for each Account you want the Name retrieved from the respective steps. In our example, the Get record step retrieves the Customer (Order Account) while the Get record 2 step retrieves the Invoice Account.
You do need these two Get record steps in order to gain access to the fields of the related record. Otherwise, if you just point to the lookup values on your Order record, you will only get the account id’s for your two accounts, as seen below.
If all is good, your result will look like the screenshot below.
Now it took a whole 5 minutes to create this, no code is required, and now you can track the flow runs individually by looking at the runs log, as you can see below.
You can also see here the failed runs, and try to re-run them directly from the Run history window by selecting a failed one and clicking on Resubmit on the ribbon, as seen below.
Drop a note below if this saved you time!