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 :
Customer experience | Sales, Customer Insights,...
Suggested answer

Create custom fields for leads through the API

(0) ShareShare
ReportReport
Posted on by 5

Hi all,

I'm working on an integration for Dynamics 365 for Sales with our system, and I'm trying to figure out a couple of things.

One thing that I would like to be able to do is to add a custom field to a lead where I could save our systems' ID so that we can cross match it later as that lead is processed. I've found a lot of documentation about custom leads, but all of them are how to create them through the UI, I wasn't able to find any information about how to do it through the Web API.

What would be the correct way to create a custom field on an entity (Lead) through the API? Can I use the access token that I have with CRM scope, or do I need to use some other Apps?

Thanks!

I have the same question (0)
  • Wahaj Rashid Profile Picture
    11,321 on at
    RE: Create custom fields for leads through the API

    Hi,

    Thank you for your query.

    As far as I understood, you need to add a custom field to store the ID of an external system.

    You do not need to create the field via API, you need to update this field using API.

    Here is the high-level solution:

    • Create a field in the Lead Tabel (entity):
      • Go to Advanced Settings -> Customizations -> Customize this System (Or create a new solution).
      • Expand Entities -> Lead -> Fields.
      • Create a new field of type Text (string), for example, new_externalid.
      • Save and Publish the entity.
      • You can also add this field on the Lead form (optional).
    • Use Web API to update this field while creating or updating the record:

                Create a table row using the Web API (Microsoft Dataverse) - Power Apps | Microsoft Docs

    You can set the new field in the Payload:

    POST [Organization URI]/api/data/v9.0/leads HTTP/1.1
    Content-Type: application/json; charset=utf-8
    OData-MaxVersion: 4.0
    OData-Version: 4.0
    Accept: application/json
    {
        "subject": "New Lead",
        "fullname": John Doe,
        "new_externalid":"LEAD-XYZ-00910"
    }

    You can also update using web-api:

    Update and delete table rows using the Web API (Microsoft Dataverse) - Power Apps | Microsoft Docs

    Create a custom field:

    Create and edit fields with Dynamics 365 Customer Engagement (on-premises) | Microsoft Docs

  • driftrock Profile Picture
    5 on at
    RE: Create custom fields for leads through the API

    Is there a way to create the field in the Lead Table through the API instead of going through the interface as you describe? I'm working on a multitenant App, and I would like to be able to create a new "external_id" field for a lead without the interaction from the user (after they have done the login and I have a valid access token on their behalf)

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Create custom fields for leads through the API

    Hello,

    It is possible to create custom columns using the API. Check this post - docs.microsoft.com/.../create-update-entity-definitions-using-web-api

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 159

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 152

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 134 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans