Leon Schmetz - Wednesday, March 7, 2012 7:44 AM:
Hello,
I am new to the forum. I am also relatively new to ARAS. I have been given the nice task to introduce ARAS into our organization. I have written a custom import for our PDM information and we have successfully import Parts,BOMs, Manufacturer Parts and Documents.
I would now like to add a custom action for files. So I have created an Action, added the Action to the Item Type and created 2 javaScript methods. Method1 executes when the Action is triggered and contains code like
var qryItem = this.newItem("Document File", "get");
qryItem.setID(this.getID());
var result = qryItem.apply();
if (result.isError()) alert('Error : Document file not found');
var fileId = result.dom.selectSingleNode("//Item/related_id/Item/id");
var fileId = result.dom.selectSingleNode("//Item/related_id/Item/id");
Next I use showModalDialog to popup a custom form like this
Leon Schmetz - Monday, March 12, 2012 9:59 AM:
Hello everybody,
I had hoped someone would respond to my question. It has taken me a week to complete the function I had in mind.
I have replaced the lines in question with these
var aras = dialogArguments.aras;
var qryItem = aras.IomInnovator.newItem("Document File", "get");
qryItem.setAttribute("action", "get");
qryItem.setAttribute("id", dialogArguments.docfile);
var result = aras.applyAML("<AML>"+qryItem.dom.xml+"</AML>");
Leon Schmetz - Thursday, March 15, 2012 9:02 AM:
Just to let you know, the only thing that was breaking my initial code was
var aras = dialogArguments.aras;
When I replace this line with
var aras = new Innovator();
everything works as expected.
The only point of attention is that I still have to pass the aras object via the dialogArguments.
So I hope all this helps developers starting out with Aras.
Leon