Get parent of context item in relationship action
Hi all,
I am using an action from a relationship grid which is driven by the PE_GetSelectedItems method. I need to get a handle on the parent item specifically as it looks like "this" returns a collection of all items open when used from this kind of action.
In my case, I thought to get the parents via relationship however the item selected may have multiple parent items from the same relationship where I need the one this method is specifically called from.
Any help is appreciated.
I found the problem. XmlNode.appendChild() moves the node, not copy. And next time the ccItem no longer has the property "source_id" and "source" becomes undefined.
This is final version, I hope )). I also added a check for re-adding a "source_id" property.
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:43a6d70b-e096-4c95-86b8-eff0e132cebe:type=javascript&text=if%20%28ccItem%29%20%7B%0D%0A%09var%20source%20%3D%20ccItem.selectSingleNode%28%22source_id%22%29.cloneNode%28true%29%3B%0D%0A%09ccItem%20%3D%20aras.getRelatedItem%28ccItem%29%3B%0D%0A%09if%20%28%21ccItem.selectSingleNode%28%22source_id%22%29%29%20ccItem.appendChild%28source%29%3B%0D%0A%7D%0D%0A]
If you use item.getProperty you get the string with parent item id. If you use getPropertyItem you get parent item. But with only "type", "keyed_name" attributes and "id" property. It will not have any more properties since they were not in the original "source_id" property.