RE: How to copy 'ownerid' column field value in dataverse table using Azure Data Factory data flow pipeline?
hi
To set the value of the OwnerId field in Dynamics 365 when the value is not available as a lookup field, you can use the following steps:
Retrieve the user or team record for the desired owner and retrieve its GUID.
Set the OwnerId field value to the GUID retrieved in step 1.
Here's an example of how you can achieve this in C# code:
// Retrieve the user or team record for the desired owner
Entity owner = _service.Retrieve("systemuser", new Guid("USER_OR_TEAM_GUID"), new ColumnSet("systemuserid"));
// Set the OwnerId field value to the retrieved GUID
Entity myEntity = new Entity("my_entity");
myEntity.Attributes["ownerid"] = new EntityReference("systemuser", owner.Id);
_service.Create(myEntity);
In this example, replace "USER_OR_TEAM_GUID" with the GUID of the desired user or team record. Also, replace "my_entity" with the logical name of your entity.
Note that if you want to assign the record to a team, you can use the "team" logical name instead of "systemuser" in the EntityReference constructor.
DAniele