cancel
Showing results for 
Search instead for 
Did you mean: 

custom workflow

tonizz
Champ in-the-making
Champ in-the-making
Hi everybody,

I only have a user, admin, in my site to publish web contents from web forms. So up to now this user has to create and submit the contents and after this, he has to "auto-review" and "auto-approve" the contents that he created. I would like to publish without having to approve or regret. In other words I would like to release directly to the main sandbox.

could be a solution creating a new custom workflow?In this case, how can I do it. More or less I know what I migth do but I dont know which files I have to edit o which are the tasks I have to modify.

Thanks in advance!
18 REPLIES 18

kvc
Champ in-the-making
Champ in-the-making
Yes, you will need to create a custom workflow.  Web Forms are required to be configured for workflow to promote to Staging.

You will want to want to use the workflow task types defined in /webapps/alfresco/WEB-INF/classes/alfresco/workflow/wcmWorkflowModel.xml.  You will also want to use /webapps/alfresco/WEB-INF/classes/alfresco/workflow/submit_processdefinition.xml as a model for your custom workflow, and create your own process definition  in the same folder location (/workflow) using the same naming convention (myworkflowname_processdefinition.xml).  Once you've created your own custom workflow, you'll want to enable it and make it visible when configuring  workflow for web forms and web projects by adding it to the <workflows/> section of web-client-config-wcm.xml in /webapps/alfresco/WEB-INF/classes/alfresco/web-client-config-wcm.xml.

The key elements from our default submit to include in your custom model are:


    <task-node name="submitted">
        <event type="node-enter">
           <action class="org.alfresco.repo.avm.wf.AVMSubmitPackageHandler"/>
        </event>
        <task name="wcmwf:submittedTask" swimlane="initiator" />
        <transition name="" to="end" />
    </task-node>

and


    <!–                 –>
    <!– End the Process –>
    <!–                 –>

    <end-state name="end"/>
   
    <event type="process-end">
        <action class="org.alfresco.repo.avm.wf.AVMRemoveAllSrcWebappsHandler"/>
        <action class="org.alfresco.repo.avm.wf.AVMRemoveWFStoreHandler"/>
    </event>


The first is responsible for actually committing your changes to Staging, and the second is responsible for clearing the virtualization server and removing your temporary workflow sandbox.

Hope that helps.


Kevin

tonizz
Champ in-the-making
Champ in-the-making
Thanks for your help kevin.

I think I have done everything you wrote in the post but something is not working.

I have created my process definition called approved_processdefinition.xml in the folder \workflow

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wcmwf:approved">

    <swimlane name="initiator"/>

    <start-state name="start">
        <task name="" swimlane="initiator"/>
        <transition name="" to="submitted"/>
    </start-state>
   
    <task-node name="submitted">
        <event type="node-enter">
           <action class="org.alfresco.repo.avm.wf.AVMSubmitPackageHandler"/>
        </event>
        <task name="wcmwf:submittedTask" swimlane="initiator" />
        <transition name="" to="end" />
    </task-node>

    <end-state name="end"/>
   
    <event type="process-end">
        <action class="org.alfresco.repo.avm.wf.AVMClearSubmittedHandler"/>
        <action class="org.alfresco.repo.avm.wf.AVMRemoveWFStoreHandler"/>
    </event>

</process-definition>


After this, I have modified the file web-client-config-wcm.xml adding my workflow:

<workflows>
     wcmwf:submit,wcmwf:approved
</workflows>

When I start alfresco tomcat It finds this error:

Cannot find WCM workflow def for configured definition name: wcmwf:approved.

Thanks.

edgar
Champ in-the-making
Champ in-the-making
When I start alfresco tomcat It finds this error:

Cannot find WCM workflow def for configured definition name: wcmwf:approved.

Same here. I have also tried deploying the workflow by issuing the command "deploy alfresco/workflow/approved_processdefinition.xml" in the Workflow Console but that gives me the error:
org.alfresco.service.namespace.InvalidQNameException: A QName must consist of a local name

cheers,

Edgar

edgar
Champ in-the-making
Champ in-the-making
Ah, found it, you need to add your custom workflow in the alfresco\WEB-INF\classes\alfresco\bootstrap-context.xml file to the list of work flow definitions:


<props>
  <!– WCM workflow definition –>
  <prop key="engineId">jbpm</prop>
  <prop key="location">alfresco/workflow/approved_processdefinition.xml</prop>
   <prop key="mimetype">text/xml</prop>
   <prop key="redeploy">false</prop>
</props>

And also you need an entry in the wcm-workflow-messages.properties file:

wcmwf_approved.workflow.title=Approved
wcmwf_approved.workflow.description=Approved without review workflow; promote to staging sandbox directly

Now in the Data Dictionary I can select the "Approved" workflow as default workflow for my Web Forms.

However in my Web Project I still only see the default Submit workflow it seems? The "Configure Workflow" tab still gives me the Review Options that belong to the Submit workflow.

regards,

Edgar

edgar
Champ in-the-making
Champ in-the-making
Another thing is, after submitting the content I get a "Submitted" task in my Tasks To Do list. However when I click "Task Done" I get the error:


Please correct the errors below then click OK.

    * A system error happened during the operation: Mandatory task properties have not been provided: {http://www.alfresco.org/model/wcmworkflow/1.0}approveCnt,
{http://www.alfresco.org/model/wcmworkflow/1.0}reviewType,{http://www.alfresco.org/model/wcmworkflow/...

Apart from that the workflow does seem to work ok. The content is submitted to the staging sandbox directly without a review step.

Can I customize the "submit" screen as well? With this simple workflow it does not make much sense that the user needs to enter the name and description of the submission.

regards,

Edgar

fmurialdo
Champ in-the-making
Champ in-the-making
edgar,

did you go further on this wcm workflow definition?
I believe I did the same steps you did, but got stuck on org.alfresco.service.namespace.InvalidQNameException: A QName must consist of a local name.
What was the piece triggering this error? The bootstrap, the properties file?

Alfresco also recommends to use  shared/classes/alfresco/extension/workflow-context.xml
rather than webapps/alfresco/WEB-INF/classes/alfresco/bootstrap-context.xml (there is an existing workflow-context.xml.sample) to define the new workflow.

Thanks.

Franck.

edgar
Champ in-the-making
Champ in-the-making
Hi,

did you go further on this wcm workflow definition?

No, I did not. Strange thing is, I got my custom workflow running fine on my local Alfresco installation (Windows XP) but have so far failed to get it running (using the same config files!) on our server (Linux). No idea why. On the server I keep getting the InvalidQNameException as well..

regards,

Edgar

slynn
Champ in-the-making
Champ in-the-making
If you change the start-state node in your process definition file from:

<start-state name="start">
    <task name="" swimlane="initiator"/>
    <transition name="" to="submitted"/>
</start-state>

To:

<start-state name="start">
   <task name="wcmwf:startTask" swimlane="initiator"/>
   <transition name="launch" to="submitted" />
</start-state>

Then it should work.  That fixed the problems for me at least.

bmui
Champ in-the-making
Champ in-the-making
I followed the steps in this forum and created the custom workflow to bypass review and approval to directly submit web content into the staging sandbox.  That worked perfectly.


Now additionally, I wanted to skip the summary page(and remove the submit items-submission info details page) when creating new web content.  I set the 'content finish' instruction to end on Step Two - Author Web Content by editing the web-client-config-wizards.xml in <alfresco>\tomcat\webapps\alfresco\WEB-INF\classes\alfresco.  This seemed to work since the Summary step was gone.


So, for example, I have a web form called 'demo-page' (which contains an xsd schema and xsl template) and wanted to test if it would submit created web content directly to the staging sandbox right after I clicked the finish button in Step Two-Author web content. 


But what resulted, was that the content I created did not go into the staging sandbox (ending up in My Sandbox) and I got an error.


Wondering if anyone knew what this error means and how I could resolve???:

Error generating rendition using demo-page.xsl: javax.xml.transform.TransformerConfigurationException: javax.xml.transform.TransformerException: javax.xml.transform.TransformerException: A node test that matches either NCName:* or QName was expected.



ALSO, I actually tried this with the Alfresco tutorial example (alfrescowww, company-footer, press-release, etc.) using the 'approved' custom workflow, instead of the default 'web site submission workflow'. 

When I clicked 'finish' on the Step Two-Author web content in My Sandbox's create web content, no error appeared, but the content still went into My Sandbox.  I would have to go to modified items and submit the content and go through the Submit Items page(enter a label & description) in order for it to go to the Staging Sandbox.  But, I want the content to be directly placed in Staging right after I clicked 'finish'.




Thanks