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

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

NEST Web API with C#: Using JSON objects to create and associate Accounts with Contacts

(0) ShareShare
ReportReport
Posted on by 10

We are using a Json object in C# to pass values to POST a new Account to our CRM.  Along with this we are passing the primarycontactid with values for first and last name.

This creates the Account along with a Contact that is associated to the Account as the primarycontact.

I t does not associate the Contact to the Account.

we would like to do this all with one call so are there any suggestions on how we should do this?

we are using httpClient1.PostAsync

Here is the current JSON:

accountnumber: "4"

primarycontactid: " 'firstname': 'John' 'lastname': 'Smith' "

name: "Amarillo College VN"

address1_line1: "6222 W. 9th Ave"

address1_city: "Amarillo"

address1_stateorprovince: "Texas"

address1_country: "USA"

address1_postalcode: "79106"

also where can we find out about any more of these tricks where we could consolidate multiple tasks within 1 request?

I have the same question (0)
  • Suggested answer
    Nya Profile Picture
    29,060 on at
    RE: NEST Web API with C#: Using JSON objects to create and associate Accounts with Contacts

    Hi,

    Have you tried to modify the value of primarycontactid with the GUID of the contact instead of the first name and last name?

    The GUID of the contact can be found in the URL of the contact’s main form.

     pastedimage1622800526473v1.png

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Nya

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: NEST Web API with C#: Using JSON objects to create and associate Accounts with Contacts

    Hello,

    Check this - docs.microsoft.com/.../create-entity-web-api

    It looks close enough to what you try to perform.

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 365 | Integration, Dataverse, and general topics

#1
#ManoVerse Profile Picture

#ManoVerse 101

#2
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#3
Martin Dráb Profile Picture

Martin Dráb 66 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans