Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

where should I put the ID 32 character in my code ? c#

Posted on by Microsoft Employee

Hi, can anyone help with my code. I have a problem with ID of the father field lookup on the contact 

how can I link a father to a specific contact ID ? and where should i put this guid.

private void button1_Click(object sender, EventArgs e)
{

EntityReference contactId = new EntityReference("contact", d);

new_Child["d"]= 7bE2A476675EE8E61180D700155D004F8B;




// Create new_child female with fields
Entity new_Child = new Entity("new_child");
// QueryExpression query = new QueryExpression("new_child");

new_Child.Attributes["new_fullname"] = "elias";

new_Child.Attributes["new_gender"] = true;

new_Child.Attributes["new_father"] = new EntityReference("new_child", d);

new_Child.Attributes["new_age"] = 3; // this.new_Age.Text;

new_Child.Attributes["new_weight"] = (decimal)5.1; // this.txtWeight.Text;

new_Child.Attributes["new_height"] = (double)10.1;

_service = GetService();
g = _service.Create(new_Child);

}

Thank you 

*This post is locked for comments

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: where should I put the ID 32 character in my code ? c#

    It should be something like:

    new_Child.Id = new Guid("07495707-3FFA-E611-8108-3863BB34FA70");

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans