Hi all,
I'm trying to create and associate a contact with the portal webapi as per this page - https://learn.microsoft.com/en-us/power-pages/configure/write-update-delete-operations#basic-create
However it keeps returning a 400 bad request error. If I remove the association it works. I've triple checked my permissions. Are we not able to associate a contact to a custom table? Do I need to use a special relationship or not binding? I feel like I've tried every premutation, but nothing works.
function setValue(userId){
var record = {};
record["a1a_contact@odata.bind"] = "/contacts("+userId+")"; // Lookup
record["a1a_name"] = userId; // Lookup
webapi.safeAjax({
type: "POST",
contentType: "application/json",
url: "/_api/a1a_login",
data: JSON.stringify(record),
success: function (data, textStatus, xhr) {
var recordId = xhr.getResponseHeader("entityid");
console.log(recordId);
},
error: function (xhr, textStatus, errorThrown) {
console.log(xhr);
}
});
}