javascript - Alfresco: Class has not been defined in the data dictionary -
i using javascript create custom data list item workflow. javascript works if use default alfresco data list, not custom one.
javascript excerpt .bpmn file
// site name , datalists var site = siteservice.getsite("testing"); var datalists = site.getcontainer("datalists"); // check data list existence if (!datalists) { var datalists = site.createnode("datalists", "cm:folder"); var datalistprops = new array(1); datalistprops["st:componentid"] = "datalists"; datalists.addaspect("st:sitecontainer", datalistprops); datalists.save(); } var orplist = datalists.childbynamepath("orplist1"); if (!orplist) { var orplist = datalists.createnode("orplist1","dl:datalist"); // tells share type of items create orplist.properties["dl:datalistitemtype"] = "orpdl:orpdatalistmodel"; orplist.save(); var orplistprops = []; orplistprops["cm:title"] = "orp list"; orplistprops["cm:description"] = "a contact list generated javascript."; orplist.addaspect("cm:titled", orplistprops); } var opportunity = orplist.createnode(null, "orpdl:orpdatalistmodel") opportunity.properties["orpdl:name"] = "florian"; opportunity.save();
model excerpts
<model name="orpdl:orpdatalistmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0"> <namespaces> <namespace uri="http://www.test.com/model/orpdatalistmodel/1.0" prefix="orpdl" /> </namespaces>
context bean
<!-- data list model registration --> <bean id="${project.artifactid}_dictionarybootstraporp" parent="dictionarymodelbootstrap" depends-on="dictionarybootstrap"> <property name="models"> <list> <value>alfresco/module/${project.artifactid}/model/orpdatalistmodel.xml</value> </list> </property> </bean>
error
org.activiti.engine.activitiexception: exception while invoking tasklistener: exception while invoking tasklistener: 06010019 failed execute supplied script: class {http://www.test.com/model/orpdatalistmodel/1.0}orpdatalistmodel has not been defined in data dictionary
the data list operates on own. problem here?
an alfresco model can contain 0 or more types, along other things constraints, aspects etc. can read more content modelling in alfresco documentation on subject
as such, when you're creating type, or setting type onto datalist, need use type's id, , not model comes
your 2 problematic lines therefore:
orplist.properties["dl:datalistitemtype"] = "orpdl:orpdatalistmodel"; var opportunity = orplist.createnode(null, "orpdl:orpdatalistmodel");
for custom datalist type short qname orpdl:orplist
, these should instead be:
orplist.properties["dl:datalistitemtype"] = "orpdl:orplist"; var opportunity = orplist.createnode(null, "orpdl:orplist");
some bits of alfresco validate you've given valid type @ creation time, not all. datalist item types 1 area doesn't validate until use, why got far did!
Comments
Post a Comment