cancel
Showing results for 
Search instead for 
Did you mean: 

Unique field in custom Model

sradha
Champ on-the-rise
Champ on-the-rise
Hi,

I have my own custom model.I want to create  a  property which can take only unique value like the cm:name field in alfresco content model.
Can anybody guide me how to do that?


Regards,
Sradha
7 REPLIES 7

mitpatoliya
Star Collaborator
Star Collaborator
I really do not think there is any configuration you can do in the model related to you customization.
Actually for cm:name also there is nothing special in model to keep it unique.
It is just during creation of noderef it check for all the existing files and that too in particular parents only not through out the alfresco.

zladuric
Champ on-the-rise
Champ on-the-rise
It also depends on how you created your custom model. Did you inherit from cmSmiley Tongueerson or cm:content or cm:folder or something like that maybe? If you did, then you already have the cm:name inherited in your type.

sradha
Champ on-the-rise
Champ on-the-rise
Hi,
I want to add a filed called attachment in my custom model to attach multiple files/supporting document and onclick of the file,the file should open .Can anybody help?

paulescom
Champ in-the-making
Champ in-the-making
Hi Sradha,

Finally, you could create a unique field to your custom model?  I currently have the same problem and I do not know how to solve it.

Thanks,

romschn
Star Collaborator
Star Collaborator
Hi Paul,

There isn't any XML configuration to define a unique field in custom content model. This cannot be achieved through configuration. Customization is required to get this implemented.
Here is a link to one of the forum post which suggests how to implement the unique field in custom content model. The approach is good. Take a look at it - https://forums.alfresco.com/comment/146372#comment-146372
Hope this helps.

romschn
Star Collaborator
Star Collaborator
There isn't any XML configuration to define a unique field in custom content model. This cannot be achieved through configuration. Customization is required to get this implemented.
Here is a link to one of the forum post which suggests how to implement the unique field in custom content model. The approach is good. Take a look at it - https://forums.alfresco.com/comment/146372#comment-146372
Hope this helps.

mrogers
Star Contributor
Star Contributor
I think what you want is a constraint.   So you could use the cm:name as an example.   

It may be that you need to add a new type of constraint.   Off the top of my head I'd back up the constraint with a value in the attribute service.