Get parent ID of item from slot

I hope this makes sense. I have a Generic Item; that item has a manual slot; In that slot I insert my snippet; In the snippet template I need to capture the content ID of the Generic item.

I’ve been doing some searching in the forum and I’ve come across the PSOReverseSlot, which I’m thinking will do the trick. My only problem is I can’t find the exact coding for this so I’m not sure how to write it.

So questions, am I correct in thinking the psoreverslot will do the trick? If so is there a thread on here that has some really good detail on how that works and how to set it up? If I’m in-correct, do you have any ideas?

Any help is appreciated.

Shane

Are you guaranteeing that the snippet template will only be used within the context of a slot? If so the following might do the trick…


#set($parent_cid = $sys.assemblyItem.getCloneParentItem().getNode().getProperty('rx:sys_contentid').String)##

You may want to check to see if the $parent_cid isn’t null or empty before doing whatever you need done…just as a sanity check of course…

Note: If you preview the snippet directly, then you won’t have a parent assembly item to clone, hence parent cid shouldn’t be defined…

Thanks for that suggestion Jitendra. That worked perfectly for me and yes I can guarantee the snippet template will only be used in a slot as there’s code that seems to get stripped out when inserted as a rhythmyx template (in ephox). Again thanks for the suggestion.

Shane