As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
<transition name="Submit Response" to="approve"> <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> var action = actions.create("create-association"); action.parameters["responseText"] = bpm_comment; action.execute(bpm_package.children[0]); </script> </action> </transition>
id: jbpm$5 name: wf:submitAdhocTask title: Start Adhoc Task description: Allocate task to colleague state: COMPLETED path: jbpm$2-@ transitions: 1 transition: [default] , title: Task Done , desc: Task Done properties: 20 {http://www.alfresco.org/model/bpm/1.0}dueDate = null {http://www.alfresco.org/model/bpm/1.0}assignee = workspace://SpacesStore/8a393a59-3952-11dc-9dc7-b925da6b15f8 {http://www.alfresco.org/model/bpm/1.0}context = workspace://SpacesStore/2ccbd6af-3952-11dc-9dc7-b925da6b15f8 {http://www.alfresco.org/model/bpm/1.0}description = ad hoc desc {http://www.alfresco.org/model/bpm/1.0}workflowDescription = ad hoc desc {http://www.alfresco.org/model/content/1.0}created = 2007-07-23 14:40:37.0 {http://www.alfresco.org/model/bpm/1.0}workflowDueDate = null {http://www.alfresco.org/model/bpm/1.0}outcome = {http://www.alfresco.org/model/bpm/1.0}completionDate = 2007-07-23 14:40:37.0 {http://www.alfresco.org/model/bpm/1.0}status = Completed {http://www.alfresco.org/model/content/1.0}owner = admin {http://www.alfresco.org/model/bpm/1.0}packageActionGroup = add_package_item_actions {http://www.alfresco.org/model/bpm/1.0}priority = 2 {http://www.alfresco.org/model/bpm/1.0}startDate = null {http://www.alfresco.org/model/workflow/1.0}notifyMe = false {http://www.alfresco.org/model/bpm/1.0}percentComplete = 0 {http://www.alfresco.org/model/bpm/1.0}taskId = 5 {http://www.alfresco.org/model/bpm/1.0}package = workspace://SpacesStore/96068cdd-3954-11dc-9dc7-b925da6b15f8 {http://www.alfresco.org/model/bpm/1.0}workflowPriority = 2 {http://www.alfresco.org/model/bpm/1.0}packageItemActionGroup = start_package_item_actions
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript"> <script> <expression> comment = ""; if (token.comments.size() > 0) comment = token.comments.get(0).message; </expression> <variable name="comment" access="write"/> </script> </action>
By "workflow context" is that the same as "process variables" as described in the wiki?
Also, what do you mean by named variables assigned to the task? The bpm_comment is a property on my task inherited from the parent bpm:Task. Do you mean the workflow script only has access to those properties I declare myself directly on my custom task?
Also, can you point me to some detail on the difference between the scripting syntaxes and how/if they impact what is accessible? I have not found anything that explains teh difference between using the <expression> tag versus exlcuding it within the AlfrescoScriptAction.
If I understand what you are saying, the wiki doc is not accurate?
I apologize for so many questions. How variables are handled and interact with scripting greatly impacts the usefulness of the Alfresco Workflow component so is a critical decision point when comparing ECM products for my client. Thanks again for your help!
In jBPM, a task may have an associated set of name/value pairs (or otherwise known as variables). This allows arbitrary data to be associated with the task. However, in jBPM, a task also supports basic built-in properties such as Id, assignee, comments, priority etc. The properties in the Alfresco Task model either map to one of the built-in jBPM task properties or a named/value pair (if a built-in property is not appropriate).At this time, only variables on the task are pushed back to workflow variables - not built-in task properties. Comment is a built-in property, therefore it's not pushed back as a workflow variable.For custom task types that derive from bpm:Task, all of their custom properties are mapped to task variables and therefore pushed back to workflow variables and accessible in script.…