Hi,
I have developed a custom workflow for WCM based on the submit to staging workflow. It has a custom decision step called validcontent. This step should check if the attached workflow content meets a number of business rules and if so the decision should transition according to the result.
Can anyone tell me how I can get access to the attached content nodes. I have tried via the bpm_package. It seems to be returning a store ID but that store cannot be instantiated in the node using var store = avm.lookupStore(bpm_package.getStoreId()); call.
Can anyone point me in the right direction on how to get access to the content in the workflow node using the javascript api. Is this possible? Also if this is not the correct way to do decision logic to do this any experience on how to do it greatly appreciated.
<decision name="validcontent" >
<event type="node-enter">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<variable name="validcontent" access="read,write"/>
<variable name="bpm_package" access="read"/>
<variable name="storeid" access="read"/>
<expression>
logger.log("Compare Store ID - " + bpm_package.getStoreId());
// for (var i = 0; i < avm.stores.length; i++) {
// var store=avm.stores;
//
// if(bpm_package.getStoreId() == store.id){
// logger.log("******************Store ID ——->"+ store.id);
// }
// }
var store = avm.lookupStore(bpm_package.getStoreId());
if(store!=null){
var storeRootNode = avm.lookupStoreRoot(args["store"]);
logger.log("store root node" +storeRootNode);
if (storeRootNode != null)
{
var path = storeRootNode.path + "/ROOT/dealer";
logger.log(+path);
var node = avm.lookupNode(path);
logger.log("node" +node);
}
} }
logger.log("In Validcontent");
logger.log("Store ID - " + bpm_package.getStoreId());
validcontent = "false";
</expression>
</script>
</action>
</event>
<transition to="end" name="reject">
<condition>#{validcontent == "false"}</condition>
</transition>
<transition to="onapprove" name="approved"></transition>
</decision>
Regards