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 :
Microsoft Dynamics CRM (Archived)

Create new record from web resource(HTML) with lookup(incident) using JavaScript

(0) ShareShare
ReportReport
Posted on by 482

I want to create new record(entity-name: mb_myEntity) with following fields using JavaScript in html form.

Field logical Name Field Type
mb_name single text
mb_case Lookup

I am unable to created records along with lookup field. Please suggest if i'm doing some mistake, here is the code for creating record

var data =

{

   "mb_name": document.getElementById("name").value,

   "mb_case@odata.bind": "incident(FB4F88B0-XXXX-XX)"

}

parent.Xrm.WebApi.createRecord("mb_myEntity",data).then(

function success(result){

alert(result.id);

},

function (error){}

);

Note: without setting up case lookup, this code is creating new record.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Arun Vinoth Profile Picture
    11,615 Moderator on at

    This should work. Try - "/incidents(FB4F88B0-XXXX-XX)"

    var data =

    {

      "mb_name": document.getElementById("name").value,

      "mb_case@odata.bind": "/incidents(FB4F88B0-XXXX-XX)"

    }

    parent.Xrm.WebApi.createRecord("mb_myEntity",data).then(

    function success(result){

    alert(result.id);

    },

    function (error){}

    );

  • Manish Profile Picture
    482 on at

    thanks for your response, but this solution didn't work for me.

  • Arun Vinoth Profile Picture
    11,615 Moderator on at

    so any error? Can you try CRM REST builder to build your queries & test it.

  • Suggested answer
    Manish Profile Picture
    482 on at

    silly mistake, correcting schema name with your suggested solution solved this issue.

    "mb_case@odata.bind": "/incidents(FB4F88B0-XXXX-XX)"

    replaces with "mb_Case@odata.bind": "/incidents(FB4F88B0-XXXX-XX)"

    Thanks,

    MB

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans