Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

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

Posted on by 95

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
    mykedeabreu 95 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
    Martin Dráb 230,235 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
    mykedeabreu 95 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
    Martin Dráb 230,235 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

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans