AnsweredAssumed Answered

how to modify content property in a workflow task from UI ?

Question asked by ddzingielewski on Jun 10, 2011
Latest reply on Jun 29, 2011 by granddams
Hi all, I am a newbie in Alfresco, I couldn't find any info about my issue looking into the forum, so I am here :)
My isssue: I want to assign value from content metadata property (attached to workflow proces) to variable that is presented in the forms (Web CLient Alfresco).

I wanna do two things:
1)assign content property "sgn:Nazwa" to my task variable "ct_nazwa" and be able to display it on my web form.
2) update (after some user changes in UI in a step przegladTask) content property "sgn:Nazwa" from task variable ct_nazwa

My workflow model:

<?xml version="1.0" encoding="utf-8"?>
<model name="ct:pomyslModel"
xmlns="http://www.alfresco.org/model/dictionary/1.0">
  <description>Example Review And Approve Task Model</description>
  <author>Alfresco</author>
  <version>1.0</version>
  <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" />
    <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
    <import uri="pl.my" prefix="sgn" />
  </imports>
 
   <namespaces>
       <namespace uri="pl.my.ct.randd" prefix="ct"/>
   </namespaces>
   
  <types>
(…)
   <type name="ct:przegladTask">
      <parent>bpm:workflowTask</parent>
       <overrides>
           <property name="bpm:packageItemActionGroup">
               <default>edit_package_item_actions</default>
           </property>
       </overrides>           
        <properties>
           <property name="ct:czyAkceptacjaPrzeglad">
              <type>d:boolean</type>
              <default>false</default>
           </property>
           <property name="ct:nazwa">
              <type>d:text</type>
           </property>
           <property name="ct:opisPomyslu">
              <type>d:text</type>
           </property>
           <property name="ct:kluczoweProblemy">
              <type>d:text</type>
           </property>         
           <property name="ct:sposobRozwiazaniaPotrzeby">
              <type>d:text</type>
           </property>         
        </properties>  
    </type>   
(…)
  </types> 
 
</model>

process definition:

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

<process-definition  xmlns="urn:jbpm.org:jpdl-3.2"  name="pomysl">

(…)
   <task-node name="przeglad">
      <task name="ct:przegladTask" swimlane="lpp"></task>
      <event type="node-enter">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
         <script>
            
             ct_nazwa = bpm_package.children[0].properties["sgn:Nazwa"];
            </script>
         </action>
      </event>      
      <event type="node-leave">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
            <script>
            bpm_package.children[0].properties["sgn:Nazwa"] =  ct_nazwa;
            </script>
         </action>
      </event>
      <transition to="czy do oceny ?"></transition>
   </task-node>

   <decision name="czy do oceny ?">
      <transition to="ocena" name="do oceny">
         <condition> #{ct_czyAkceptacjaPrzeglad}</condition>
      </transition>
      <transition to="do archiwum" name="to do archiwum"></transition>      
   </decision>

   (…)

</process-definition>

web-client-config-custom.xml:


<?xml version="1.0" encoding="utf-8"?>
<alfresco-config>

<!– pomysl forms –>
<config evaluator="string-compare" condition="Content Wizards">
   <content-types>
      <type name="sgn:Pomysl" />
   </content-types>
</config>
<config evaluator="node-type" condition="sgn:Pomysl">
    <property-sheet>
       <show-property name="mimetype" display-label-id="content_type" component-generator="MimeTypeSelectorGenerator" />
      <separator name="sep2" display-label="Inne właściwości" component-generator="HeaderSeparatorGenerator" />
        <show-property name="sgn:Nazwa" display-label="Nazwa"  />
        <show-property name="sgn:OpisPomyslu" display-label="Opis pomysłu" />
        <show-property name="sgn:PotrzebaZrodlowa" display-label="Potrzeba źródłowa" />
        <show-property name="sgn:SposobRozwiazaniaPotrzeby" display-label="Sposób rozwiązania potrzeby"  />
        <show-property name="sgn:KluczoweProblemy" display-label="Kluczowe problemy" />

       <show-association name="sgn:Autor" display-label="Autor" />
       <show-association name="sgn:Sponsor" display-label="Sponsor" />
       <show-association name="sgn:LeaderProspektu"  display-label="Lider prospektu"/>
        <show-property name="sgn:Uzasadnienie" display-label="Uzasadnienie" />
        <show-property name="sgn:Priorytet" display-label="Priorytet" />
        <show-property name="sgn:Status" display-label="Status"  />
        <show-property name="sgn:Kategoria" display-label="Kategoria" />
        <show-property name="sgn:DomenaSGN"  display-label="Domena"/>
    </property-sheet>
</config>
<config evaluator="string-compare" condition="Advanced Search">
    <advanced-search>
    <content-types>
    <type name="sgn:Pomysl" />
    </content-types>
    <custom-properties>
    <meta-data type="sgn:Pomysl" />
    </custom-properties>
    </advanced-search>
</config>

<config evaluator="node-type" condition="ct:przegladTask"
replace="true">
  <property-sheet>
    <separator name="sep1" display-label-id="general"
    component-generator="HeaderSeparatorGenerator" />
    <show-property name="bpm:taskId" />
    <show-property name="bpm:description"
    component-generator="TextAreaGenerator" read-only="true" />
    <show-property name="ct:nazwa" />
  </property-sheet>
</config> 
</alfresco-config>


my content model:

<model name="sgn:randdPomyslModel"
xmlns="http://www.alfresco.org/model/dictionary/1.0">
  <description>Model Pomysłu</description>
  <author>dd</author>
  <version>1.0</version>
  <imports>
    <!– Import Alfresco Dictionary Definitions –>
    <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
    <!– Import Alfresco Content Domain Model Definitions –>
    <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
  </imports>
   <namespaces>
       <namespace uri="pl.my" prefix="sgn"/>
   </namespaces>
(…)
  <types>
    <type name="sgn:Pomysl">
        <title>Pomysł dla Research And Development</title>
        <parent>cm:content</parent>
        <properties>
(…)
           <property name="sgn:Nazwa">
              <title></title>
                <type>d:text</type>
           </property>
           <property name="sgn:OpisPomyslu">
              <title>Ogólny opis pomysłu</title>
                <type>d:text</type>
           </property>
           <property name="sgn:PotrzebaZrodlowa">
              <title>Problem/potrzeba źródłowa</title>
                <type>d:text</type>
           </property>
           <property name="sgn:SposobRozwiazaniaPotrzeby">
              <title>Sposób rozwiązania problemu/zaspokojenia potrzeby</title>
                <type>d:text</type>
           </property>
           <property name="sgn:AktualneSposobyRozwiazania">
              <title>Aktualnie stosowane sposoby rozwiązywania problemu/zaspakajania potrzeby </title>
                <type>d:text</type>
           </property>
           <property name="sgn:SzacunkowaWielkoscRynku">
              <title>Szacunkowa wielkość rynku docelowego</title>
                <type>d:text</type>
           </property>
           <property name="sgn:CechyUnikalnePomyslu">
              <title>Cechy unikalne charakteyzujące pomysł</title>
                <type>d:text</type>
           </property>
           <property name="sgn:KluczoweProblemy">
              <title>Kluczowe problemy dot. wdrożenia pomysłu/wykonalności rozwiązania </title>
                <type>d:text</type>
           </property>
           <property name="sgn:SposobGenerowaniaWartosci">
              <title>Sposób generowania wartości </title>
                <type>d:text</type>
           </property>
      </properties>
  </type>
(…)
 
</model>

thanks for any help
dd

Outcomes