Louise - Monday, September 26, 2016 7:58 AM:
Hi,
I've created my own .html file on the server, that I use for showing a dialog (using below code):
Client method calling my custom .html:
var result = top.aras.modalDialogHelper.show("DefaultModal", win, params2, { dialogWidth: 325, dialogHeight: 400, center: true}, "../Solutions/test.html");
In the test.html I use top.aras.applyMethod() to call a server side method:
Custom .html file:
var result = top.aras.applyMethod("myMethod", this);
aras.AlertError(typeof result); // --> Shows returned type is string
My problem is that the variable result is now of type "string", not "Item", even though my server side method returns an item:
Server side method:
string AML = "<AML><Item type='Part' action='get'></Item></AML>";
Item parts = inn.applyAML(AML);
return parts;
Because "result" is not an Item, I can't use any of the methods like .getItemByIndex() or .getItemCount().
I have also verified that I have the same issue when trying to run AML directly from my .html file:
var aml = "<AML><Item type='Part' action='get'></Item></AML>";
var result = top.aras.applyAML(aml);
Am I missing something, or is there a way to convert string to Item? (the string looks like items, so when I just print the variable it looks like I've got an Item)
edonahue - Monday, October 10, 2016 11:45 AM:
Hi Louise,
I recommend using getItemsByXPath(<XPath string>) to extract the items from the string stored in the result variable. You should be able to pull out one or more items using the XPath string "//Item" and then perform any of the usual item functions.