Blog
Move Data Between Records that are Not Directly Related
Suppose you want to move data between records that are not directly related, but share a common parent. Beringer Technology Group’s Decimal Field Copy custom workflow can dynamically move values between records like these.
In our example, Child A and Child B records belong to two separate entities and have no direct relationship, but they both lookup to the same parent record. Using these parental relationships, we can easily carry data between the two child records using the Decimal Field Copy workflow.
Here, we are looking at the aptly named “Parent Record” with one related record in each entity. Lets create a workflow that will run on the change of the Value field on Child A and send the value to the Child B record.
The workflow is created in the Child A entity and it will start on the change of the Value field.
Under the workflow step properties, we need to add some inputs. The Source Value is the field that contains data that we want to copy over to Child B. The Source Parent Relationship is the name of the relationship that Child A has to the parent entity. Target Entity name is the schema name of the entity that we want to copy data to. The Target Field Name is the field on Child B that we want to update with the Source Value. The Target Parent Relationship is the relationship name that Child B has to the parent entity (I’ve named these relationships identically for both child entities, but you don’t have to). Save and Activate the workflow and enter some information into Child A’s Value field and voila!
The workflow successfully copied data from Child A to Child B.
Let’s dive deeper into this workflow’s functionality.
Suppose that we added a second Child B record. The current state of our workflow would update that record as well. This isn’t always helpful, and so a filter is necessary to make sure we update the correct records in Child B. You may have noticed in the image of the workflow above that there are 2 inputs we did not fill out. Let’s update our workflow to only copy data to specific records.
I’ve created an option set field, “Record Type,” in the Child B entity with three options: 1, 2 and 3. I want to adjust the workflow so that data is only copied to Child B records that have the Record Type set to “2.” In order to do this, we’ll need some XML.
Open an advanced find and create your filter, then click “Download Fetch XML.” Open the file in Notepad or some other suitable text editor.
We only need the Filter information highlighted in blue.
Copy this and paste into the Target FetchXML Filter input, save, and activate the workflow again.
The workflow now ignores Child B records that don’t meet the filter criteria. Using a variation of the FetchXML code, we can pass a dynamic Filter Variable, rather than the static “2” variable used in this instance.
This workflow extends Dynamics 365’s functionality to meet a variety of needs, though workflows like this one fit best in the XRM realm.
Beringer is always here to provide expert knowledge in topics like these. Contact us today with any questions you may have.
Beringer Technology Group, a leading Microsoft Gold Certified Partner specializing in Microsoft Dynamics 365 and CRM for Distribution. We also provide expert Managed IT Services, Backup and Disaster Recovery, Cloud Based Computing and Unified Communication Solutions.