Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to assign a task or a Lead to a Member or Team Programmaticaly

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi guys,

Can anyone guide me how I can set a task or lead to a member or a team programmatically?

 var proxyService = ConnectToCRM(CRMuri, CRMusername, CRMpassword);

            try
            {
                //String strLeadTopic = "New Lead at " + System.DateTime.Now.ToString();

                Entity ipsLead = new Entity("lead");
                ipsLead.Attributes["subject"] = crmLeadModel.LeadSubject;
                ipsLead.Attributes["firstname"] = crmLeadModel.FirstName;
                ipsLead.Attributes["lastname"] = crmLeadModel.LastName;
                ipsLead.Attributes["jobtitle"] = crmLeadModel.JobTitle;
                ipsLead.Attributes["telephone1"] = crmLeadModel.BusinessPhone;
                ipsLead.Attributes["mobilephone"] = crmLeadModel.MobilePhone;
                ipsLead.Attributes["emailaddress1"] = crmLeadModel.EmailAddress;

                ipsLead.Attributes["companyname"] = crmLeadModel.CompanyName;
                ipsLead.Attributes["websiteurl"] = crmLeadModel.CompanyWebsite;
                ipsLead.Attributes["address1_country"] = crmLeadModel.CompanyCountry;

                ipsLead.Attributes["description"] = crmLeadModel.Description;

                // User Service Proxy to create the entity object
                proxyService.Create(ipsLead);
                return true;
            }
            catch (Exception ex)
            {
                //throw new Exception("CMR Error occurred - " + ex.Message);
                return false;
            }

*This post is locked for comments

  • Tim Dutcher Profile Picture
    Tim Dutcher 2,100 on at
    RE: How to assign a task or a Lead to a Member or Team Programmaticaly

    You can also get the GUID for records using Advance Find. First, list the records (e.g., all teams), export to Excel and open the Excel file. Then unhide columns A through C. You'll find the record GUID in column A.

  • Suggested answer
    PS Profile Picture
    PS 23,577 on at
  • Suggested answer
    Kumar Viju Profile Picture
    Kumar Viju 1,026 on at
    RE: How to assign a task or a Lead to a Member or Team Programmaticaly

    Anything between %7b------%7d

    GUID = 78908357-E58E-E611-8121-005056AE3C40

    So next time you can follow the same approach to get GUID.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to assign a task or a Lead to a Member or Team Programmaticaly

    Ok. I Managed.

    Now, I get this link: ipsdev.obeikan.com.sa/main.aspx;extraqs=formid%3d7ba7fac1-1418-4335-935f-f7f8dfd73fcc&id=%7b78908357-E58E-E611-8121-005056AE3C40%7d&pagetype=entityrecord>

    which one is the Guid? I mean from where to where?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to assign a task or a Lead to a Member or Team Programmaticaly

    Sorry for answering you again. I have outlook but now it is still opening the chrome browser now. How Can I change it?

  • Suggested answer
    Kumar Viju Profile Picture
    Kumar Viju 1,026 on at
    RE: How to assign a task or a Lead to a Member or Team Programmaticaly

    Do you have outlook installed on your PC. You can select any mailing app if you dont habe outlook, it will opn the link.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to assign a task or a Lead to a Member or Team Programmaticaly

    Hi I am trying it out but at first it tells me to select an app to open and select a browser. Then nothing displays. Then Clicked on Email a link again and nothing is shown now.

  • Kumar Viju Profile Picture
    Kumar Viju 1,026 on at
    RE: How to assign a task or a Lead to a Member or Team Programmaticaly

    Hi,

    Open the team record in CRM and in the Ribbon there should be button ( Possibly the  three dots..) , check for "EMAIL LINK". This will pop out the link of the team and you can copy GUID of that team.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to assign a task or a Lead to a Member or Team Programmaticaly

    ipsLead.Attributes["ownerid"] = new EntityReference("systemuser", GUID(userid));

    And the 'ownderid' is the general name one? I can use that? And do you know how I can get the Team Guid from CRM online because I can view the Team Details but cannot find the GUID?

    Thank you

  • Suggested answer
    Tim Dutcher Profile Picture
    Tim Dutcher 2,100 on at
    RE: How to assign a task or a Lead to a Member or Team Programmaticaly

    The CRM SDK includes a file named EntityMetadata.xlsx that provides the schema name for all out-of-box entities.

    The logical name is the same string as the schema name but is lower case. So, for users, SystemUser is the schema name and systemuser is the logical name... Team and team... etc.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,375 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans