Sort Order parameter for Dynamics 365 API call



I am using AEM Forms and connecting form elements to Microsoft Dynamics 365.

I use the Form Data Model to create API endpoints to connect with the specific Dynamics 365 entities I am interested in.

The problem I am facing is that the data returned from a Dynamics 365 entity is not in the order I require. The data coming back has a default sort order by created date; I need the data sorted alphabetically to populate a drop-down list.

The APIs in Microsoft Dynamics 365 allow for an Order By parameter; however, I do not know how to specify the Order By parameter in the Form Data Model API. The Form Data Model API allows for a filtering parameter but I cannot seem to get an Order By parameter to work.

Below is some JavaScript used to bind the API endpoint to a drop-down list.

var operationInfo = {

    "formDataModelId": "/content/dam/formsanddocuments-fdm/ms-dynamics-fdm",

    "operationTitle": "GET account /accounts",

    "operationName": "GET account /accounts_15209302043150"


var inputs = {

    "isinstitution": true


var outputs={





guidelib.dataIntegrationUtils.setOptionsFromService(operationInfo, inputs, outputs);

It doesn't appear that the 'var inputs' allows for an Order By parameter either.

How can I add an Order By parameter to the Microsoft Dynamics 365 API in the Form Data Model or when binding the drop-down list?

Accepted Solutions (0)

Answers (7)

Answers (7)



Thanks for the code snippet.

I tried this code already; the callback function was not getting called. It seems like either an unsupported API with a 4th parameter, or has since been deprecated.

The Adobe documentation does not indicate support for a callback function.

I am using AEM v6.4.5




use this rather

guidelib.dataIntegrationUtils.executeOperation(operationInfo, inputs, outputs, callbackFunction);

You can do a set value in the callback funtion.


window.map1 = new Map();

function initializeDropdown(jsonResult) { 

   var arrAllNaics = JSON.parse(jsonResult);

  var arrDropDownItems = [];

  for ( var i=0; i<arrAllNaics.length; i++ )

  { var oNaics = arrAllNaics[i];

   var sDescription = oNaics.agentID;





  } dropdownlist1570739946741.items = arrDropDownItems;



   var operationInfo = {

"formDataModelId": "/content/dam/formsanddocuments-fdm/fdm2",

"operationTitle": "get",

"operationName": "get_15671949377350"};

   var inputs = { };

   var outputs = { };

guidelib.dataIntegrationUtils.executeOperation(operationInfo, inputs, outputs, initializeDropdown);



The returned JSON is abstracted away from me as I am using the Adobe guidelib.dataIntegrationUtils libraries. The returned JSON is not available to use when binding to a drop-down list.



Yes, the Option text and value need to be different. The text needs to be sorted alphabetically, whereas the Option value represents the Entity ID (guid).