Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Javascript/Api Call to Create a new record with a lookup field

(0) ShareShare
ReportReport
Posted on by 99

Hi All,

I am trying to create a record using code below generated from XRM CRM Rest Builder. The code works if I remove the lookup field so I know its a problem there. Any ideas what I am missing?

xxxxx is my tenant code which I am just masking.

var entity = {};
entity.cr93b_name = results.entities[i]["xxxxx_jdeadressbooknumber"];
entity.cr93b_contacttype = 900450000;
entity.cr93b_emailaddress = results.entities[i]["xxxxx_emailaddress"];
entity.cr93b_phonenumber = results.entities[i]["xxxxx_phonenumber"];
entity.cr93b_jdeaddressbooknumber = results.entities[i]["xxxxx_jdeadressbooknumber"];
entity["cr93b_vendorrequestmanagementid@odata.bind"] = "/xxxxx_vendorrequestmanagements(9d7fb079-5082-44d8-a60c-292be6f4f68d)";

Xrm.WebApi.online.createRecord("xxxxx_vendorrequestmanagementcontactinfo", entity);

If I comment out the lookup field it creates the record.

  • mykedeabreu Profile Picture
    99 on at
    RE: Javascript/Api Call to Create a new record with a lookup field

    General I think is good.

  • Martin Dráb Profile Picture
    233,741 Most Valuable Professional on at
    RE: Javascript/Api Call to Create a new record with a lookup field

    No problem, I can simply move the thread. Do you know which forum would be appropriate?

  • mykedeabreu Profile Picture
    99 on at
    RE: Javascript/Api Call to Create a new record with a lookup field

    Hi Martin - its not apologies. didnt realize I was inside the finance forum

  • Martin Dráb Profile Picture
    233,741 Most Valuable Professional on at
    RE: Javascript/Api Call to Create a new record with a lookup field

    Is this somehow related to Dynamics 365 Finance or shall I move it to another forum?

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Eugen Podkorytov Profile Picture

Eugen Podkorytov 106

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106 Most Valuable Professional

Overall leaderboard

Product updates

Dynamics 365 release plans