Display custom properties from a Workflow
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2011 05:02 AM
Hello,
I want to show some custom properties in my workflow from a webscript. I have tried 3 methods :
1. Using Alfresco Wescript : alfresco/service/api/workflow-instances/activiti$3086
(it doesn't show the custom properties).
2. Custom webscript, with JS API
I try getProperties but it still null
Error using the var : Expression t.properties["sgfwf:montant1"] is undefined
Custom worfklow Model
How can I do ?
Alfresco 4.0b
Thanks 🙂
http://wiki.alfresco.com/wiki/Workflow_JavaScript_API
http://wiki.alfresco.com/wiki/FreeMarker_Template_Cookbook#Workflow_Tasks_Example
I want to show some custom properties in my workflow from a webscript. I have tried 3 methods :
1. Using Alfresco Wescript : alfresco/service/api/workflow-instances/activiti$3086
(it doesn't show the custom properties).
2. Custom webscript, with JS API
I try getProperties but it still null
var infoWorklow= workflow.getAssignedTasks();var outputRows=""; for each (var task in infoWorklow){ outputRows +="<br>"; outputRows += "<td>"+task.getId() +"</td>"; outputRows += "<td>"+task.getName() +"</td>"; outputRows += "<td>" + task.getProperties() + "</td>"; }
3. Custom Webscript, with FTLError using the var : Expression t.properties["sgfwf:montant1"] is undefined
<table cellspacing=0 cellpadding=2> <#list workflow.completedTasks as t> <tr> <td>${t.id}</td> <td>${t.type}</td> <td>${t.name}</td> <td>${t.description}</td> <td>${t.properties["cm:created"]?datetime}</td> <td><#if t.properties["bpm:startDate"]?exists>${t.properties["bpm:startDate"]?datetime}<#else><i>None</i></#if></td> <td><#if t.properties["bpm:dueDate"]?exists>${t.properties["bpm:dueDate"]?datetime}<#else><i>None</i></#if></td> <td>${t.properties["bpm:priority"]}</td> <td>${t.properties["bpm:percentComplete"]}</td> <td>${t.properties["bpm:status"]}</td> <td>${t.isCompleted?string("Yes", "No")}</td><td>${t.properties["sgfwf:montant1"]}</td> </tr> </#list></table>
Custom worfklow Model
<?xml version="1.0" encoding="UTF-8"?> <!– Definition of a Workflow –><model name="sgfwf:workflowModel" xmlns="http://www.alfresco.org/model/dictionary/1.0"> <!– Optional meta-data about the model –> <description>Custom Workflow Model for Finance</description> <author>Custom</author> <version>1.0</version> <!– Imports are required to allow references to definitions in other models –> <imports> <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" /> <import uri="http://www.alfresco.org/model/bpm/1.0" prefix="bpm" /> </imports> <!– Introduction of new namespaces defined by this model –> <namespaces> <namespace uri="http://www.custom.ch/model/workflow/finance/1.0" prefix="sgfwf" /> </namespaces> <types> <type name="sgfwf:submitStart"> <parent>bpm:startTask</parent> <properties> <property name="sgfwf:account1"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:centre1"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:genre1"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:montant1"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:libelle1"> <type>d:text</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:account2"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:centre2"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:genre2"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:montant2"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:libelle2"> <type>d:text</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:account3"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:centre3"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:genre3"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:montant3"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:libelle3"> <type>d:text</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:account4"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:centre4"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:genre4"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:montant4"> <type>d:int</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:libelle4"> <type>d:text</type> <mandatory>false</mandatory> <multiple>false</multiple> </property> <property name="sgfwf:approveRejectOutcome"> <type>d:text</type> <default>Reject</default> <constraints> <constraint name="sgfwf:approveRejectOutcomeOptions" type="LIST"> <parameter name="allowedValues"> <list> <value>Approve</value> <value>Reject</value> </list> </parameter> </constraint> </constraints> </property> </properties> <!– To select a user –> <mandatory-aspects> <aspect>bpm:assignee</aspect> </mandatory-aspects> </type> <type name="sgfwf:modifyReviewTask"> <parent>sgfwf:submitStart</parent> </type> <type name="sgfwf:reviewByBoss"> <parent>sgfwf:submitStart</parent> </type> <type name="sgfwf:approvedTask"> <parent>sgfwf:submitStart</parent> </type> <type name="sgfwf:rejectedTask"> <parent>sgfwf:submitStart</parent> </type> </types></model>
How can I do ?
Alfresco 4.0b
Thanks 🙂
http://wiki.alfresco.com/wiki/Workflow_JavaScript_API
http://wiki.alfresco.com/wiki/FreeMarker_Template_Cookbook#Workflow_Tasks_Example
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2011 08:33 AM
It's ok with task.properties["sgfwf:montant1"]
var infoWorklow= workflow.getAssignedTasks();var outputRows=""; for each (var task in infoWorklow){ outputRows +="<br>"; outputRows += "<td>"+task.getId() +"</td>"; outputRows += "<td>"+task.getName() +"</td>"; outputRows += "<td>" + task.properties["sgfwf:montant1"] + "</td>"; }
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2011 09:01 AM
How can I get list of workflows (and properties) related with a current document with FTL ?
I have a custom code showing properties of a document :
I have a custom code showing properties of a document :
<#list results?sort_by(["properties","cm:created"]) as child>…<url>${docUrl}</url><cifsUrl>\Alfresco${relativePath}</cifsUrl><fileName>${child.name}</fileName><created>${child.properties["cm:created"]?datetime}</created><modified>${child.properties["cm:modified"]?datetime}</modified><nodeReference>${child.nodeRef}</nodeReference><ticket>${session.ticket}</ticket><type>${child.type}</type><properties><#if child.properties['sg:documentNb']?exists & (child.properties['sg:documentNb']?length !=0)><#assign val = "${child.properties['sg:documentNb']?c}"/><documentNb>${val}</documentNb> </#if>…
