How do i create a booking with the Xrm.WebApi.createRecord. I have the following:
// Create Booking
var newBookData = {
"name": newworkorder_result.name,
"starttime": booking_result.starttime,
"msdyn_estimatedarrivaltime": booking_result.msdyn_estimatedarrivaltime,
"endtime": booking_result.endtime,
"resource@odata.bind": `/bookableresources(${booking_result._resource_value})`
}
console.log(newBookData);
Xrm.WebApi.createRecord("bookableresourcebooking", newBookData).then(
function success(result) {
console.log(result);
},
function (error) {
console.log(error.message);
}
)
I keep getting:
1: Error identified in Payload provided by the user for Entity :'bookableresourcebookings', For more information on this error please follow this help link https://go.microsoft.com/fwlink/?linkid=2195293 ----> InnerException : Microsoft.OData.ODataException: An undeclared property 'resource_bookableresource' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.
This is usually related to like customer lookup fields, so not sure why I'm getting it on a normal lookup field. Any help would be appreciated.