Forum Discussion
christopher_gillis
7 years agoCommunity Manager
Hi Angela,
One idea is to create a Client Method that can take in the context of another Method and pull out the Item based on that context. I created a simple example of this called
Christopher Gillis Aras Labs Software Engineer
GetItemFromWindow in a test environment with code like the example below.
var win = inArgs.contextWindow;
var itm = null;
// Get the item based on the context of the method calling this
if (win) {
var itm = win.parent.item || this;
}
return itm;
You can then call this Method from any other client method using something like the sample below.
var methodArgs = {
contextWindow: window
}
var itm = aras.evalMethod("GetItemFromWindow", this.node, methodArgs);
Assuming that the logic of the GetItemFromWindow Method is sound, you can write context-independent client Methods that can be reused with any location.
The code in my sample would need to be updated to include a check for CUI, but this could be a neat Community Project when you get it working! Submitting a new project during Hacktoberfest will earn you some exclusive Aras swag.
Chris
Christopher Gillis Aras Labs Software Engineer