Extended functionality for PSOUniqueWithinFolders


We have a requirement to maintain uniqueness of a filed on a content type in a site. And to achieve that I have used PSOUniqueWithinFolders extension and passed the sitepath as an argument. This works well within the site as intended.

We now want to make that content type visible to other sites and still want to maintain the uniqueness of the field within the site but not across sites. For e,g Under two different sites, values for that field can be repeated but under one site there cannot be duplicates. Can we use PSOUniqueWithinFolders extension ( with some tweaking ) for our requirement?

I can write a custom extension for this but would like to know before I start if there is any OOTB feature we can use for such a case?

Also, is there an easy way to know the site path where the content item is being created in an extension?


I can address the last question: depending on when the extension is fired, you should have a sys_folderid parameter that you can use to figure out where the item is being created. If this is null, I believe this implies that the item is not being created in a folder and hence will just show up in all community content. From the folder id, you should be able to get the folder path and or the site path…


Thanks for the answer. I think the better way is to design my own extension.


Yes, the extension solution would be ideal…however, you still need to know where the item is being created (which is where the sys_folderid comes into play). On the default system, one can create an item outside of the folders and thus make it only visible in community items (and also not be in any site). I am not sure whether you have used the PSOUniqueWithinFolders or some other extension to prevent the end user from doing that (or using the “remove from folder” action).