Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How do we insert or create a new contact in Microsoft Dynamics CRM?

Posted on by Microsoft Employee

For now we have completed the authentication process through azure. And now our next step is to create or insert a new contact in Microsoft Dynamics CRM. Please provide me a rest API documentation through which i can create a new contact through iOS.

*This post is locked for comments

  • Suggested answer
    ashlega Profile Picture
    ashlega 34,475 on at
    RE: How do we insert or create a new contact in Microsoft Dynamics CRM?

    Hi Rupesh,

     have not worked with IOS, but this post seems to be covering the authentication and basic Web API:

    scaleablesolutions.com/connect-ios-app-to-dynamics-crm-using-web-api

     Once/if you have that, you'll find a bunch of examples on how to create records through Web API usage here:

    msdn.microsoft.com/.../gg328090.aspx

  • Suggested answer
    shivaram Profile Picture
    shivaram 3,315 on at
    RE: How do we insert or create a new contact in Microsoft Dynamics CRM?

    Hi Rupesh,

    If you import Managed solution CRM Rest builder in to your solution, then you will get one button like CRM Resr Builder. once you click it, you will get options like, create, update,retrieve,retrieve Multiple etc. Once you select any thing and give any options and click generate query, then it will give you a query.

    Resr-Code.png

    Resr-Code.png

    Hope it helps you

    Best regards,

    Shivaram

  • Suggested answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How do we insert or create a new contact in Microsoft Dynamics CRM?

    Hi,

    If you are using JavaScript, you can use something similar to the following code:

    function createContact()

    {

       var serverURL = Xrm.Page.context.getClientUrl();

       var contact = {};

       contact["firstname"] = "John";

       contact["lastname"] = "Smith";

       contact["emailaddress1"] = "john.smith@contoso.com";

       var req = new XMLHttpRequest();

       req.open("POST", crmServerUrl + "/api/data/v8.0/contacts", true);

       req.setRequestHeader("Accept", "application/json");

       req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

       req.setRequestHeader("OData-MaxVersion", "4.0");

       req.setRequestHeader("OData-Version", "4.0");

       req.onreadystatechange = function () {

           if (this.readyState == 4 /* complete */) {

               req.onreadystatechange = null;

               if (this.status == 204) {

                   var contactUrl = this.getResponseHeader("OData-EntityId");

               } else {

                   var error = JSON.parse(this.response).error;

                   alert(error.message);

               }

           }

       };

       req.send(JSON.stringify(contact));

    }

    If you are using Azure, and you want to do this using C#, see the following code sample from Microsoft:

    msdn.microsoft.com/.../mt779074.aspx

    You can also see this article by scalable solutions how to add authentication to the code above.

    scaleablesolutions.com/web-api-authentication-from-javascript

    Hope this helps.

  • EmployeeOcta Profile Picture
    EmployeeOcta on at
    RE: How do we insert or create a new contact in Microsoft Dynamics CRM?

    You can use mscrm sdk .

    web api to be exposed and that should be published on the server.

    consume this web api from ios.

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