I have created custom folder with custom type with the help of onNewFolder action.Just changing itemId.
Custom folder have field like field1,field2 etc.... There is no cm:name property in that custom type.
Node is created but name is something like 'c3ee5007-296e-4dfa-a642-e5a26ca364fa' but i want to assign name like field1_field2.
How can i do that?
Custom Type :
<types>
<type name="abcroject">
<title>Project</title>
<parent>cm:folder</parent>
<mandatory-aspects>
<aspect>abcrojectId</aspect>
<aspect>abcrojectName</aspect>
<aspect>abcrojectConsultantName</aspect>
<aspect>abc:region</aspect>
</mandatory-aspects>
</type>
</types>
toolbar.js
this.widgets.newMOTCFolder = Alfresco.util.createYUIButton(this, "newMOTCFolder-button", this.onNewMOTCFolder,
{
disabled: true,
value: "CreateChildren"
});
var templateUrl = YAHOO.lang.substitute(Alfresco.constants.URL_SERVICECONTEXT + "components/form?itemKind={itemKind}&itemId={itemId}&destination={destination}&mode={mode}&submitType={submitType}&formId={formId}&showCancelButton=true",
{
itemKind: "type",
itemId: "abcroject",
destination: destination,
mode: "create",
submitType: "json",
formId: "doclib-common"
});
etc........
share-config-custom.xml
<config evaluator="model-type" condition="abcroject">
<forms>
<!-- Default Create Content form -->
<form id="doclib-common">
<field-visibility>
<show id="abcrojectId" />
<show id="abcrojectName" />
<show id="abcrojectConsultantName" />
<show id="abcman" />
</field-visibility>
<create-form template="../documentlibrary/forms/doclib-common.ftl" />
<appearance>
<field id="abcrojectId" />
<field id="abcrojectName" />
<field id="abcrojectConsultantName"/>
<field id="abcman" />
</appearance>
</form>
</forms>
</config>
Then you need to either implement a folder rule or a behaviour to set the cm:name property to a value concatenated from the values of the two fields. For a behaviour, the OnCreateNode policy might be useful. If you want to keep the name synchronized to the values of the two fields, you may also want to implement the OnUpdateProperties policy.
Hi,
Here field1 and field2 are combobox.
My condition is that same folder name should not be repeated then how can I full fill that? Because rule is executed after node creation.
If you base the name on these fields, and two nodes use the same values for these fields, then their name will conflict, and saving will fail, giving user the chance to pick different values.
Here,First node is created then rule will apply and rule is prevented to assign same name so what about that created node.Do we need to delete that node and display message that name is already exist?
The rule is applied as part of the transaction (provided you do not explicitly specify to run it "in the background"). So if the rule changes the name to something that conflicts, then the conflict is detected and the transaction is rolled back. No need to delete anything, because rolling back the transaction means everything is undone...
Hello You can achieve this by the combination of behavior (NodeServicePolicies.OnUpdatePropertiesPolicy)
and overriding the front end validation while submitting the form (If you are not using java webscript to create folder).
basically, you need to override the "form.post.json.js" file.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.