All,
I need help with writing a javascript that will count how many salesorderdetail record is associated with the salesorder and also get the salesorderdetail guid.
The salesorderid seen below is for the order only, how can i get all the salesorderdetail associated with thats sales order ? Then update the stock status if it is blank.
var StockStatus = {}; StockStatus .available = 1; var salesorderId = Xrm.Page.data.entity.getId(); var req = new XMLHttpRequest(); req.open("PATCH", Xrm.Page.context.getClientUrl() + "/api/data/v8.0/salesorderdetails(salesorderId)", 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 || this.status === 200) { } else { alert(this.statusText); } } }; req.send(JSON.stringify(StockStatus));