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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Unable to set lookup field value using Xrm.WebApi.online.createRecord

(0) ShareShare
ReportReport
Posted on by 15

I'm creating new record using Xrm.WebApi.online.createRecord. I'm adding lookup field value while creating record. See my code below. In the code, new_engagementsector is my lookup field name, 'new_sectors' is the name of lookup entity & 'cr0f8_engagements' is my entity name in which i am adding record.

var entity = {};
entity["new_engagementsector@odata.bind"] = "/new_sectors(97511775-8737-ea11-a813-000d3a0a827e)";

Xrm.WebApi.online.createRecord("cr0f8_engagements", entity).then(
function success(result) {
var newEntityId = result.id;
},
function(error) {
Xrm.Utility.alertDialog(error.message);
});

Its giving below error,

An error occurred while validating input parameters: Microsoft.OData.ODataException: An undeclared property 'new_engagementsector' which only has property annotations in the payload but no property value was found in the payload.

Is there anything missing in code? please help.

I have the same question (0)
  • Suggested answer
    Naveen Ganeshe Profile Picture
    3,397 User Group Leader on at

    Hello Vishal,

    Everything looks good but please make sure you are using the schema name for "new_engagementsector" field.

  • Suggested answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hello,

    You need to use schema name of the field instead of logical name.

    entity["SchemaNameofthefield@odata.bind"] = "/new_sectors(97511775-8737-ea11-a813-000d3a0a827e)";

    Please check below link.

    community.dynamics.com/.../create-record-of-custom-entity-through-web-api

  • cloflyMao Profile Picture
    25,210 on at

    Hi,

    To update a lookup field, you should use field schema name.

    You can find schema name property in entity > fields.

    pastedimage1579158137931v1.png

    In most of cases, it will contains some upper case characters.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 130 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 117

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans