Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

C# Dynamics 365 SDK - "team With Id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Does Not Exist" error while changing the "ownerid" attribute of an entity record

Posted on by Microsoft Employee

We are trying to change the owner of an entity record using UpdateRequest message with the corresponding entity record. This happens only while changing any entity record owner from a team to a user.

For e.g. If there is an existing entity record Record1 with OwnerId as Team1 then we are trying to perform the following:

  1. Create an entity instance with existing entity Id (Record1) and new OwnerId (an entity reference instance with Id as user1 and LogicalName as ""(this is as per our current code logic)) attributes.
  2. Call Execute method with UpdateRequest message with the above entity instance.
  3. The operation was successful and OwnerId was also updated to user1 in CRM.

But if we try to change the owner again from user1 to user2 then we are getting the below error from CRM.

"team With Id = user1 Does Not Exist"

This happens only when we try to change the owner to the user (User1) using the same user's (User1) credentials but if we try to change the owner using the other user's (User2) credentials then it's working. But this is not issue with change the owner to User2 using User2 credentials.

Also everything works fine if we create an entity reference instance with Id as user1 and LogicalName as "systemuser" instead of "" for OwnerId attribute.

Could anyone please help me out finding the below.

  1. Why CRM is looking up in the Team entity records with User1 which is an user id on the following Change Owner operation even after the previous Change Owner was successful?
  2. Why is it happening with User1 though he is having System Administrator role but User2 is not having the same role?

*This post is locked for comments

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: C# Dynamics 365 SDK - "team With Id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Does Not Exist" error while changing the "ownerid" attribute of an entity record

    Don't forget to verify helpul answers as replies.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: C# Dynamics 365 SDK - "team With Id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Does Not Exist" error while changing the "ownerid" attribute of an entity record

    Yes it's really weird and thanks for significant suggestions. We have fixed it by passing the appropriate LogicalName as of now anyway.

  • Verified answer
    Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: C# Dynamics 365 SDK - "team With Id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Does Not Exist" error while changing the "ownerid" attribute of an entity record

    Hi,

    Actually it's weird.

    Maybe your user1 and team1 is same Identity (GUID) in database (normally there is no chance for this but maybe about integration fault etc), you should check that.

    On the other hand, normally you should give "logicalname" for EntityReference, I think when you don't set this name in your code (new EntityReference("", assigneeId)), OwnerId changed but "OwnerIdType" code still protect its value (team = 9), and when you try assign again OwnerId and OwnerIdType code not matched.

    I recommend below;

    - Firstly monitor your database process (Sql Profiler) with your current code (new EntityReference("", assigneeId)) and check what happens in SQL commands

    - Change your code with entity logicalname and check again.

    - Last but important note you should use logicalname in EntityReference ;)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: C# Dynamics 365 SDK - "team With Id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Does Not Exist" error while changing the "ownerid" attribute of an entity record

    No Emre. It's as below and hence the mentioned behavior. But it works as expected if we create an EntityReference instance with systemuser  as LogicalName as mentioned by you and a33ik.

    Entity entity = new Entity(targetEntityLogicalName.Trim());
    entity.Id = targetId;
    entity["ownerid"] = new EntityReference("", assigneeId);]
    



  • Emre GULCAN Profile Picture
    Emre GULCAN 2,379 on at
    RE: C# Dynamics 365 SDK - "team With Id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Does Not Exist" error while changing the "ownerid" attribute of an entity record

    Hi,

    Is your code same with this;

    Entity entity = new Entity(targetEntityLogicalName.Trim());
    entity.Id = targetId;
    entity["ownerid"] = new EntityReference("systemuser", assigneeId);
    
              


  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: C# Dynamics 365 SDK - "team With Id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Does Not Exist" error while changing the "ownerid" attribute of an entity record

    Hello,

    I have no idea. It's mostly platform thing so nobody except Microsoft (who has an access to sourcecode) has an answer.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: C# Dynamics 365 SDK - "team With Id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Does Not Exist" error while changing the "ownerid" attribute of an entity record

    Hi Andrii,

    Thanks for the quick reply. Yes, we tried that and it worked without any issues. But just would like to understand why is it happening for User1 but not User2 inspite of User1 is having System Administrator role.

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: C# Dynamics 365 SDK - "team With Id = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Does Not Exist" error while changing the "ownerid" attribute of an entity record

    Hello,

    Is there any chance you can populate LogicalName with "systemuser" value? That should resolve your issue.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans