cancel
Showing results for 
Search instead for 
Did you mean: 

Updating workflow properties usning the alfresco java script

kirit
Champ on-the-rise
Champ on-the-rise
hi,
i want to update the property of the workflow using the alfresco java script.
what could be the way to achive that?

e.g
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$workflowTest";
workflow.parameters["bpm:description"] = document.name;
workflow.parameters["bpm:assignee"] = assignee;
  workflow.execute(document);
workflow.parameters["bpm:status"] = "custom_status";

if i use this script as a business rule, its NOT changing the status or workflow to my custom status.
i need to change the status or any other properties which are available with the workflow task.
4 REPLIES 4

brian_robinson
Champ in-the-making
Champ in-the-making
Try replacing the ':' with a '_' character, like this:

workflow.parameters["bpm_status"] = "custom_status";

Thanks,
-Brian

kirit
Champ on-the-rise
Champ on-the-rise
Thanks you Brian!!
i have tried your suggestions, it is not working

i am able to change the status by extending the RhinoScriptProcessor.java (execute() Method).

but i am still looking for the solution from the js script itself so i need not to extend the default alfresco class.

jayjayecl
Confirmed Champ
Confirmed Champ
bpm:status is a constrained value :


<constraint name="bpm:allowedStatus" type="LIST">
            <parameter name="allowedValues">
                <!–  TODO: Determine if status values can be mapped to human-readable strings –>
                <list>
                    <value>Not Yet Started</value>
                    <value>In Progress</value>
                    <value>On Hold</value>
                    <value>Cancelled</value>
                    <value>Completed</value>
                </list>
            </parameter>
        </constraint>


<property name="bpm:status">
                    <type>d:text</type>
                    <mandatory>true</mandatory>
                    <default>Not Yet Started</default>
                    <constraints>
                        <constraint ref="bpm:allowedStatus" />
                    </constraints>
                </property>

I think that your "custom_status" is not among the allowed values, and that is why it's not modified.

Then, either you set the status to an allowed value, either you create your own custom:customStatus property (in your own model)

regards

kirit
Champ on-the-rise
Champ on-the-rise
Hi, i have tried this, but still not working for me.  Smiley Sad