I've used CRM REST Builder to create code to update a bookableresource of a bookableresourcebooking; var entity = {}; entity["resource@odata.bind"] = "/resources(3c456b51-1r37-e822-a86e-000d4a27609a)"; var req = new XMLHttpRequest(); req.open("PATCH", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/bookableresourcebookings(01ec82a6-8719-t911-a964-000f3a396aa4)", true); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.onreadystatechange = function() { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 204) { //Success } else { Xrm.Utility.alertDialog(this.statusText); } } }; req.send(JSON.stringify(entity)); But I get this error message: An undeclared property 'resource' 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 Looking up the resource field in bookableresourcebooking: _resource_value@OData.Community.Display.V1.FormattedValue:"Bobs Ur Uncle", _resource_value@Microsoft.Dynamics.CRM.associatednavigationproperty:"Resource", _resource_value@Microsoft.Dynamics.CRM.lookuplogicalname:"bookableresource", _resource_value:"5b2350e0-by6b-e854-r63c-000d3a5h1b6f", So its a bookableresource but associated with a resource? That's a separate entity all together. How do I update it?
↧