RE: SelectedControlSelectedItemIds not working correctly on Ribbon workbench - with Unified Interface - Queue Item
I used this function to retrieve the GUID of the related record wrapped in the queue item record (not sure that is correct term)
selectedControlItemId is the queue item GUID
queuItemId is the returned GUID of the related record
I used Jason Latimer's CRM REST builder as it was a bit tricky to get the related record from the queue item record
var getRelatedQueuItemRecordId = function (selectedControlItemId) {
var urlString = "/api/data/v9.1/queueitems(" + selectedControlItemId.toString() + ")?$select=_objectid_value,objecttypecode,_queueid_value,queueitemid"
var req = new XMLHttpRequest();
var queueItemId = null;
var _objectid_value_lookuplogicalname = "";
var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + urlString, false);
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;
if (this.status === 200) {
var result = JSON.parse(this.response);
var _objectid_value = result["_objectid_value"];
queueItemId = _objectid_value;
} else {
Xrm.Utility.alertDialog(this.statusText);
}
}
};
req.send();
return queueItemId;
};