cancel
Showing results for 
Search instead for 
Did you mean: 

Re:Workflow control through button click

lakshmi
Champ in-the-making
Champ in-the-making
Hi,

I have a requirement, that whenever a content is created i should have a additional button like 'submit to worklfow'. When a user clicks on the button, the content should follow my workflow.

Help me how to implement this.

I intially had a 'execue script as a rule', this will send my doc to wf as soon as it is created in a space. But now i need to control it with a button in UI.

pls help out

Thanks,
Lakshmi.
12 REPLIES 12

lakshmi
Champ in-the-making
Champ in-the-making
Hi kevin,

I went thru the wiki doc you gave.

Here is what i did,

In web-client-config-custom.xml:

<actions>
<!– Launch js_test Dialog –>
<action id="js_test">
<label>Test javascript</label>
<image>/images/icons/add.gif</image>
<script>/Company Home/Data Dictionary/Scripts/workflow.js</script>
<params>
<param name="dummy">dummy1</param>
<param name="id">#{actionContext.id}</param>
</params>
</action>

<!– Add action to more actions menu for each document–>
<action-group id="document_browse">
<action idref="js_test" />
</action-group>
</actions>

I dont know how to include this action in the jsp.I found on wiki the following and included it in container.jsp (as i want a button that will execute my script once a content is created)but it throws exception when i click on it in UI:

<r:actions value="document_browse" context="#{BrowseBean.document}" showLink="false" />

Am not sure what i shud give in the 'context' here. This gives a small icon in UI, but i want a button that will just execute my script, any way i can link my action-group to a button?

dhalupa
Champ on-the-rise
Champ on-the-rise
You should follow the path presented by Kevin. Context is NodeRef of your document on which you start the workflow. Try to read  this document more carefully

http://wiki.alfresco.com/wiki/Externalised_Client_Actions#Action_Definition_Config_Elements

I think that if you insist on using h:commandbutton and not r:actions that you have to use ActionService to execute the configured action inside the ActionListener method of you managed bean. Again, ActionService could be injected into the Managed Bean just as you did with ScriptService.

Example of usage is org.alfresco.web.bean.actions.RunActionWizard.java look at finishImpl method

Kind regards,

Denis

lakshmi
Champ in-the-making
Champ in-the-making
Hi i tried including the action group in container.jsp.
I get a icon but when i click on it i get the following error:

javax.faces.FacesException: Cannot get value for expression '#{DocumentDetailsBean.name}'
caused by:
org.apache.jasper.JasperException: Cannot get value for expression '#{DocumentDetailsBean.name}'
caused by:
javax.faces.el.EvaluationException: Cannot get value for expression '#{DocumentDetailsBean.name}'
caused by:
javax.faces.el.EvaluationException: org.alfresco.web.bean.DocumentDetailsBean
caused by:
javax.faces.el.EvaluationException: Bean: org.alfresco.web.bean.DocumentDetailsBean, property: name
caused by:
java.lang.reflect.InvocationTargetException
caused by:
java.lang.NullPointerException


code details:

web-clinet-config-custom.xml:

<actions>
<!– Launch js_test Dialog –>
<action id="js_test">
<label>Test javascript</label>
<image>/images/icons/add.gif</image>
<script>/Company Home/Data Dictionary/Scripts/workflow.js</script>
<params>
<param name="dummy">dummy1</param>
<param name="id">#{actionContext.id}</param>
</params>
</action>

<!– Add action to more actions menu for each document–>
<action-group id="document_browse">
<action idref="js_test" />
</action-group>
</actions>

container.jsp added this action:

<r:actions value="document_browse" context="#{DocumentDetailsBean.document}" showLink="false" />

Pls help out…