Hi everyone,
I have written a JS code to add entry into Dataverse table. It has a Lookup field to Contact table and table I have set the access type of that table as Contact so API will return data of loggedin user only..
Here is my Relationship for my table & contact table
here is my code:
function addData() {
console.log('...adding data')
var recOBj = {
new_streetname:document.getElementById('street-name').value,
new_streetno:document.getElementById('street-number').value,
'new_ContactRelation@odata.bind' : '/contacts/({{user.id}})'
};
webapi.safeAjax({
type: "POST",
url: "/_api/new_xxxxxxxxxxxx",
contentType: "application/json",
data: JSON.stringify(recOBj),
success: function (res, status, xhr) {
alert("✅ Record Added Successfully");
},
});
}
when I added 'new_ContactRelation@odata.bind' : '/contacts/({{user.id}})' then it is giving me error in console and if i remove that lookup code, then its working well.
Do I need to configure something else for this??
I did following:
1. Added realtion between my table and contact table
2. Necesary permission given
Let me know, Thanks 🙂