How to call a server method with applyMethod() from a client method, and use the results coming back from server

Server Method : [Get_Identity_Details] Can run this and get results I want. Hard coded guid for test

Innovator inn = this.getInnovator();
string sessionuserid = this.getProperty("sessionuser","invalid");
if (sessionuserid == ""){}

StringBuilder sql = new StringBuilder();
sql.AppendLine("SELECT ID,KEYED_NAME FROM [ArasDev].[innovator].[IDENTITY] WHERE CLASSIFICATION='Group' AND ID in ");
sql.AppendLine(" ( SELECT SOURCE_ID from [ArasDev].[innovator].[MEMBER] where RELATED_ID in");
sql.AppendLine("( SELECT ID FROM [ArasDev].[innovator].[IDENTITY] WHERE CLASSIFICATION='Role' AND ID in");
sql.AppendLine("( SELECT SOURCE_ID from [ArasDev].[innovator].[MEMBER] where RELATED_ID in");
sql.AppendLine("(SELECT RELATED_ID from [ArasDev].[innovator].[ALIAS] where SOURCE_ID='<USER GUID>'");
sql.AppendLine("))))");

Item results = inn.applySQL(sql.ToString());

return results;

=======================================

Client method : calls the server method. Can see the result in debug from server method, but it does not work after that. How to make use of the results from server method?

var inn = new Innovator();
var userid = inn.getUserID();

var itemTypeDropdownComponent = getFieldComponentByName("owned_by_id");
var itemTypeDropdownList = [];


var body = "<sessionuser>" + userid + "</sessionuser>";
var res = aras.applyMethod("NOV_Identity_Details",body);

if (res.isError()) {
aras.AlertError(res);
return;
}
else if (res.getItemCount() === 0)
{
  //do something
}
else
{
for (var i=0;i<res.getItemCount();i++)
{
var currentItem = res.getItemByIndex(i);
itemTypeDropdownList.push({label: currentItem.getProperty("KEYED_NAME"), value: currentItem.getProperty("ID")})
}
}
itemTypeDropdownComponent.component.setState({
list: itemTypeDropdownList
});

return null;

Parents Reply Children
No Data