In a model-driven powerapp I’m trying to create SharePoint document location using JavaScript and Client API that should be related to a custom entity.
Here is my code:
**//creates records in table via WebAPI call
function createRecordForTable(tableName, dataObj) {
// create table record
Xrm.WebApi.createRecord(tableName, dataObj).then(
function success(result) {
console.log("Record created with ID: " + result.id);
},
function (error) {
console.log(error.message);
}
);
}
//myresponse is object that holds some of needed values
//hel__exceptions is custom entity
const data = new Object();
data.name = myresponse.name;
data.relativeurl = myresponse.relativeurl;
data.absoluteurl = myresponse.absoluteurl;
data["parentsiteorlocation_sharepointdocumentlocation@odata.bind"] = "/sharepointdocumentlocations/(" + myresponse.sharepointdocumentlocationid + ")";
data["regardingobjectid_hel__exceptions@odata.bind"] = "/hel__exceptionses/(" + exceptionId +")";
data.sitecollectionid = myresponse.sitecollectionid;
createRecordForTable("sharepointdocumentlocation", data);**
The error received is: Empty segment encountered in request URL. Please make sure that a valid request URL is specified.
It looks like I’m missing some data that I need to pass with the call Xrm.WebApi.createRecord in order to create the record in sharepointdocumentlocation table.
Please help!