Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

How to retrieve the guid for salesorderdetail? (Web API JavaScript Experts help!)

$
0
0

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));

Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>