AnsweredAssumed Answered

Mandatory target of an association and integrity check

Question asked by jayjayecl on Mar 12, 2010
Latest reply on Apr 17, 2012 by mjboere
Hi,
I am facing a problem I don't know how to manage.
The fact is that I have an aspect defining an association whose target is mandatory :

<aspect name="custom:associations">
<title>associations</title>
<associations>
<association name="custom:assocCategory">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cm:category</class>
<mandatory>true</mandatory>
<many>false</many>
</target>
</association>
</associations>
</aspect>

The problem is that I cannot add this aspect to any document (using the "run action" wizard), because Alfresco raises an Integrity error (see stacktrace attached).
I do understand why the integrity check fails (the association is mandatory, but at the moment of adding the aspect, there is no target registered in the association).
However, if you define, in the custom model, a mandatory text property, you can still add the aspect, even if the property is not set yet.

What workaround would be best for me :
- I need to define an association to a category target
- I need to make it mandatory, so that on the "edit properties" form, a user cannot validate it if the association has not been filled.

Thank you

Outcomes