How to associate two Dynamics 365 custom entities with a n:n relationship from Data Factory
I have built an integration between two systems (one being a Power Platform application built in Dynamics 365) using Azure Data Factory and need to associate records which are getting created by the interface to another entity in the target system. The two entities have a many to many (n:n:) relationship defined within Dynamics.
I have tried using the built in Dynamics connector within Data Factory to perform an upsert on the relationship table, however I get a message stating "The 'Create' method does not support entities of type x" with x being the relationship entity between the two primary entities.
Is there a way for me to create this association from Data Factory?
I have come up with a few workarounds but feel like this should really be handled by Data Factory connectors. Any input on these workarounds is also welcome.
1) Option 1 is to drop the built in connector and try to communicate directly with the Dynamics Web API using a Post command to associate the two records but this seems unnecessary and could get complicated in Data Factory as I need to both associate new records and disassociate records if the records need to be unlinked.
2) Option 2 is to move the relationship management portion of this integration out of Data Factory entirely and add a custom plugin to the Dynamics 365 solution which would handle the linking/unlinking of the entities based on a string field set by the integration containing a concatenated list of Ids of records that should be associated. The concern here is this plugin could potentially get triggered hundreds to thousands of times very rapidly depending on the amount of records being processed via the integration and I am not sure if there are any performance or other concerns with this approach.
@Sandeep009 Our solution was to record a comma deviated list of unique keys (stored as a string) identifying the records expected to be related to the record being updated by the Data Factory. We then created a plugin that runs within Power Platform when the record is created/updated. This plugin parses the list of keys and performs a lookup for each to build a list of related records and then manages the n:n relationships by removing existing relationships that are no longer represented in the list of keys and adds any that are missing. I hope that helps.
Sign in to comment