How to get Hidden Property of an Item
- 7 years ago
Hi Vinay,
it seems like 'this'-Item that you are working with in your onAfterGet-method does not include the xxxxx-Property in its dom, so you'll have to fetch that somehow. There is a "serverEvents"-attribute that you can set on an item before applying it so that the onAfterGet-method is not triggered in an endless loop:
var myItem = inn.newItem("Share", "get");
myItem.setAttribute("serverEvents", "0");
myItem.setAttribute("select", "xxxxx");
myItem.setID(this.getID()); // careful with this.getID(). When getting multiple items at the same time, for the grid view, for example, 'this' will be an item collection and 'this.getID()' will return a "Not a single item" error.
var resultItem = myItem.apply();
string xxxxxValue = resultItem.getProperty("xxxxx");I'm not entirely certain how exactly that attribute works, since it seems to only sometimes stop server events of an item from firing, and other times it does not, but please do try this out in your case when trying to fetch the property from the server.
Alternatively, you could do a SQL-query in your onAfterGet-method. SQL-queries ignore Aras Server events, so you should not get any infinite loops, but be careful: SQL-queries also bypass Aras' permissions setup, so please use the corresponding IOM-methods if at all possible. Nevertheless, here's what the SQL query in your onAfterGet method could look like:string sql = "SELECT xxxxx FROM innovator.[Share] WHERE id='idOfYourItem'";
var sqlResult = inn.applySQL(sql);
string xxxxxValue = sqlResult.getItemByIndex(0).getProperty("xxxxx");