I am trying to figure out how to get my process results in the flow order that they are setup, but I am not sure where that value is stored and how to do an order by to get the results I am looking for:
var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v9.0/processstages()" +
"?$expand=processid($select=*)" +
"&$filter=primaryentitytypecode eq 'opportunity'" +
"&$orderby=_processid_value asc,stagecategory", 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.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
req.onreadystatechange = function() {
if (this.readyState === 4) {
req.onreadystatechange = null;
console.clear();
if (this.status === 200) {
var result = JSON.parse(this.response);
console.log('Get Process Stages: ', result.value);
} else {
console.log(JSON.parse(this.response).error);
}
}
};
req.send();
For example the process should be Qualify, Develop, Approval, Close. However you can see in the image below that Close is before Approval.

*This post is locked for comments
I have the same question (0)