Показать сообщение отдельно
Старый 28.02.2024, 04:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,477 / 846 (79) +++++++
Регистрация: 28.10.2006
crmtipoftheday: Tip #1441: Owner is a user is a team
Источник: https://crmtipoftheday.com/1441/owne...user-is-a-team
==============

WARNING: Niche L400 tip ahead.

tl;dr

If you’re expect primary column name to be tablename + “id“, add an exception for systemuser and team tables – both will come back as ownerid in custom API.

L400

If custom API has an output property of type EntityReference then, for example, for account (or any other “normal”) table, the following json is returned as expected:

"Account": { "@odata.type": "#Microsoft.Dynamics.CRM.account", "accountid": "87aa5cfb-197c-ea11-a813-000d3abeef18" }
Save yourself a trip to metadata and use tablename + “id” for the primary column name, right? Not so fast. For either systemuser or team, you get ownerid instead of expected systemuserid or teamid

"User": {  "@odata.type": "#Microsoft.Dynamics.CRM.systemuser", "ownerid": "889362cfb-22aa-eaea-abba-dead3a6a9942"}
No one knows dev docs better than Jim Daly, his patience to express RTFM sentiment is fascinating.
In Web API ownerid is the primary key for the systemuser EntityType and the team Entitytype because both inherit this property from the principal EntityType, which enables the capability for either types to be owners of records.

— Jim Daly
The ownerid value is the same as the respective systemuserid or teamid columns.



Источник: https://crmtipoftheday.com/1441/owne...user-is-a-team
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.