Skip to main content

Notifications

Announcements

No record found.

Customer Service forum

ConnectionTo field not populated with Xrm.WebApi.createRecord("connection", data)

(0) ShareShare
ReportReport
Posted on by 85

I running this piece of code and this creates a Connection Record in the case mentioned here. But it doesn't add the Contact in the ConnectionTo Field. Is this not the right way of creating a connection record?

var data = {
"record2id@odata.bind": "/contacts(47655a8a-44ac-e911-8199-000d3a71c895)",
"record2roleid@odata.bind": "/connectionroles(65cf47c9-c8a9-e911-8199-000d3a71c895)",
"record1id@odata.bind": "/incidents(caef5d28-b8a9-e911-8199-000d3a71c895)",
"record1roleid@odata.bind": "/connectionroles(65cf47c9-c8a9-e911-8199-000d3a71c895)"
}

parent.Xrm.WebApi.createRecord("connection", data).then(
function success(result) {
alert("Success. Id: " + result.id);
},
function (error) {
parent.Xrm.Utility.alertDialog('Connection error - ' + error.message);
}
);
Categories:
  • Suggested answer
    Manoj  Profile Picture
    Manoj 85 on at
    RE: ConnectionTo field not populated with Xrm.WebApi.createRecord("connection", data)

    I resolved it. It was just that I should have given the record type for each Contact and Incident, like this:

                   var data = {

                       "record2id_contact@odata.bind": "/contacts(" + contactId + ")",

                       "record2roleid@odata.bind": "/connectionroles(65cf47c9-c8a9-e911-8199-000d3a71c895)",

                       "record1id_incident@odata.bind": "/incidents(caef5d28-b8a9-e911-8199-000d3a71c895)",

                       "record1roleid@odata.bind": "/connectionroles(65cf47c9-c8a9-e911-8199-000d3a71c895)",

                   }

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans