Forum Discussion
christopher_gillis
7 years agoCommunity Manager
Hi Angela,
The sample I wrote is just one possible implementation, but the goal is to make the way you call
Christopher Gillis Aras Labs Software Engineer
GetItemFromWindow as generic as possible. window is actually a JavaScript object that can give us information about where the method is being called from, so the methodArgs at least in this sample should always look like var methodArgs = { contextWindow: window }. The GetItemFromWindow function should then be able to figure out what the context is based on what properties it has access to from the contextWindow.
To answer your second question, I don't believe that you have access to the item itself from the context of the cui button, so the getItemById call is necessary.
Chris
Christopher Gillis Aras Labs Software Engineer