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)

Contact created using API

(0) ShareShare
ReportReport
Posted on by

I created a contact in Dynamics 365 by using SOAP Api. Is there a flag or audit stamp in dynamics which would confirm that the contact was created/modified by API?

Thanks, 

Manik Soi

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Hi,

    If you are using WebApi, the following should be your code to create a Contact record:

    var entity = {};

    entity.firstname = "John";

    entity.lastname = "Smith";

    entity.emailaddress1 = "john.smith@contoso.com";

    entity.new_createdfromwebapi = 1;

    var req = new XMLHttpRequest();

    req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/contacts", true);

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

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

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

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

    req.onreadystatechange = function() {

       if (this.readyState === 4) {

           req.onreadystatechange = null;

           if (this.status === 204) {

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

               var regExp = /\(([^)]+)\)/;

               var matches = regExp.exec(uri);

               var newEntityId = matches[1];

           } else {

               Xrm.Utility.alertDialog(this.statusText);

           }

       }

    };

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

    The newEntityId will return the newly created contact Id value from your request. If there is a value there, you know contact is created.

    You can add a field to your contact entity called Created from Api, which you pass to your contact form that will specify when this was created from the Web Api. You can probably use one of the existing fields on the contact entity for this as well.

    Hope this helps.

  • Suggested answer
    NicksTuk Profile Picture
    1,833 on at

    You could either use a specific account only for records created through API, or you could put a custom flag on the record and raise it for records created in that manner, if you need to track that.

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