web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Create record in CRM with Team as owner

(0) ShareShare
ReportReport
Posted on by 943

Hi All,

We have one requirement in which we need to create a record programmatically through C# and need set Owner of the record as predefined owner team. Please let me know the viable approach for this. Is it possible to to create record and set team as owner in single CRM call.

Kindly help!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    M.Azwar Alam Profile Picture
    on at

    Hi,

    You need to create a record first and then you can assign it. Following is the url you can check

    msdn.microsoft.com/.../gg327897.aspx

    Mark answer as verified, if it works for you

  • Verified answer
    Gopalan Bhuvanesh Profile Picture
    11,401 on at

    Hi

    If the Owner Team is already available then get the Team Id using a query (from the Team Name).

    Then create the record setting that Team as the owner. In the following code, replace the Team guid value with a variable.

    Entity contact = new Entity("contact");
                contact["lastname"] = "Email Recipient2";
                contact["parentcustomerid"] = new EntityReference("account", new Guid("955554E7-842B-E711-8104-5065F38B06F1"));
                //contact["ownerid"] = new EntityReference("systemuser", new Guid("7D523B58-D316-E711-8101-5065F38B6621"));
                contact["ownerid"] = new EntityReference("team", new Guid("940BD8EF-4B13-E711-80FF-5065F38A4A21"));
                
                organizationService.Create(contact);
  • Varun Singh Profile Picture
    943 on at

    Thanks Gopalan. I don't know how I missed this simple code :-)

    contact["ownerid"] = new EntityReference("team", new Guid("940BD8EF-4B13-E711-80FF-5065F38A4A21"));

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans