简体   繁体   中英

In Dynamics 365 API, How to reference proper ownership entity for detail when owner can be systemuser or team?

Using version 9.

I am able to use the SDK just fine on the Organization Service to RetrieveEntityChanges on entities, in this example lets say all the changes on the opportunity entity.

This will give me a set of records that have changed since the last dataVersion.

There is a foreign key called "ownerid" on the opportunity record which can point to the primary attribute on EITHER the systemuser entity/table, OR on the team entity/table. If I need detail about the owner, I don't know how to figure out, in the context of my code, which of these two it joins to.

RetrieveEntityChanges will not respond with the owneridtype attribute, and for that matter neither will a query constructed and passed to RetrieveMultiple.

I haven't tried RetrieveEntity, but it seems like it would be quite chatty if I had to call RetriveEntity on every record I got back from RetrieveEntityChanges only for that purpose.

There must be a better and more efficient way?

Any technical insights would be much appreciated.

When you are creating your RetrieveEntityChangesRequest , set owningteam and owninguser in your ColumnSet instead of ownerid . This way when record ownership changes your NewOrUpdateEntity AttributeSet will contain only one of those two fields and its value will be an EntityReference to a team or to an user.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM