cancel
Showing results for 
Search instead for 
Did you mean: 

Adding new content type to alfresco workflow

konart
Champ in-the-making
Champ in-the-making
What I'm trying to do is to have a select element on workflow start form with a list of companies. Depending on a chosen company name workflow engine should choose what to do next (choose next step).

I'm still quite lost about how this whole thing works actually (too complicated for me I guess) and this is what I have tried at the moment:

First, I create a new model company.xml:

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

    <model name="itn:company" xmlns="http://www.alfresco.org/model/dictionary/1.0">

        <description>Company model</description>
        <author>konart</author>
        <version>1.0</version>

        <imports>
            <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"></import>
            <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"></import>
        </imports> 

        <namespaces>
            <namespace uri="http://www.iteranet.ru/model/content/1.0" prefix="itn" />
        </namespaces>
    </model>
   
    <types>
        <type name="itn:Company">

            <title>Компания</title>

            <parent>cm:content</parent>        
            <properties>
                <property name="itn:Name">
                    <title>Название</title>

                    <type>d:text</type>

                    <protected>false</protected>

                    <mandatory>true</mandatory>

                    <multiple>false</multiple>

                    <default>Итеранет</default>
                </property>
            </properties>
           
            <constraints>
               <constraint name="itn:Name" type="LIST">
                    <parameter name="AllowedValues">
                        <list>
                            <value>Итеранет</value>
                            <value>СофтЭра</value>
                        </list>
                    </parameter>
                </constraint> 
            </constraints>
   
        </type>
    </types>


Next, I add this model  to my workflow's -context file:

    <property name="models">
            <list>
                <value>alfresco/extension/model/DirectiveWorkflowModel.xml</value>
                <value>alfresco/extension/company.xml</value>
            </list>
    </property>


Then, I add it to the web-client-config-custom.xml:

    <alfresco-config>
    
       <config evaluator="string-compare" condition="Languages">
          <languages>
             <language locale="ru_RU">Russian</language>
          </languages>
       </config>

       <config evaluator="node-type" condition="dir:start" replace="true">
          <property-sheet>

          <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />
   
          <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
          <show-property name="itn:Company" />

          <show-association name="bpm:assignee" />
          </property-sheet>
       </config>
    </alfresco-config>


And finally to the share-config-custom.xml:

       <config evaluator="string-compare" condition="activiti$PerformDirective">
          <forms>
             <form>
   
                <field-visibility>
                   <show id="bpm:workflowDescription"/>
                   <show id="bpm:assignee"/>
                   <show id="packageItems" />
                   <show id="itn:Company" />
                </field-visibility>
                <appearance>
   
                   <set id="" appearance="title" label-id="workflow.set.general" />
                   <set id="assignee" appearance="title" label-id="dir_assignee" />             
                   <set id="items" appearance="title" label-id="dir_items" />

                   <field id="bpm:workflowDescription" label-id="dir_description">
                      <control template="/org/alfresco/components/form/controls/textarea.ftl">
                         <control-param name="style">width: 95%</control-param>
                      </control>
                   </field>
                   <field id="bpm:assignee" label-id="dir_assign_to" set="assignee" />
                   <!–<field id="packageItems" set="items" label-id="dir_pitems" />–>
                   <field id="itn:Company" set="items" label-id="itn_company_name" />
                </appearance>
             </form>
          </forms>
       </config>


labels are in place too.

This gives no effect at all.

Any tips on where this goes wrong? Or any other suggestions?
3 REPLIES 3

jpotts
World-Class Innovator
World-Class Innovator
Your workflow model is the thing that tells the Activiti form about the company list.

Your task form needs to map to a type in your workflow model. Your type in the workflow model needs to have a company field, and you can import the constraint from your ITN company model if you would like so that you don't have to repeat your list in both XML files.

Jeff

konart
Champ in-the-making
Champ in-the-making
I've tried to put company list into my WF model, so it looks like this now:

<?xml version="1.0" encoding="UTF-8"?>
<!– Описание модели бизнес-процесса –>
<model name="dir:workflowmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">

   <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="http://www.iteranet.ru/model/content/1.0" prefix="itn" />
   </imports>

   <namespaces>
      <namespace uri="http://www.somecompany.ru/model/workflow/1.0" prefix="dir" />
   </namespaces>

   <types>
      
      <type name="dir:start">
         
         <parent>bpm:startTask</parent>
         
         <mandatory-aspects>
            
            <aspect>bpm:assignee</aspect>
         </mandatory-aspects>

         <properties>

            <property name="dir:company">
               <type>d:text</type>
               <default>reject</default>
               <constraints>
                  <constraint name="dir:companyName" type="LIST">
                     <parameter name="allowedValues">
                        <list>
                           
                           <value>SoftEra</value>
                           
                           <value>Iteranet</value>
                        </list>
                     </parameter>
                  </constraint>
               </constraints>
            </property>
         </properties>

      </type>

</model>



I also added company property to the web-client:


<alfresco-config>

   <config evaluator="string-compare" condition="Languages">
      <languages>
         <language locale="ru_RU">Russian</language>
      </languages>
   </config>

   <config evaluator="node-type" condition="dir:start" replace="true">
      <property-sheet>

      <separator name="sep1" display-label-id="general" component-generator="HeaderSeparatorGenerator" />

      <show-property name="bpm:workflowDescription" component-generator="TextAreaGenerator" />
      <show-property name="dir:company" />

      <show-association name="bpm:assignee" />
      </property-sheet>
   </config>
</alfresco-config>

And share-config:

<code>

   <config evaluator="task-type" condition="dir:start">
      <forms>
         <form>

            <field-visibility>
               <show id="bpm:workflowDescription"/>
               <show id="bpm:assignee"/>
               <show id="packageItems" />
            <show id="dir:company" />
            </field-visibility>
            <appearance>

               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="assignee" appearance="title" label-id="dir_assignee" />             
               <set id="items" appearance="title" label-id="dir_items" />

               <field id="bpm:workflowDescription" label-id="dir_description">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="bpm:assignee" label-id="dir_assign_to" set="assignee" />
               <field id="packageItems" set="items" label-id="dir_pitems" />
               <field id="dir:company" set="items" label-id="itn_company_name" />
            </appearance>
         </form>
      </forms>
   </config>



After alfresco restart I receive 500 Error:

An error has occured in the Share component: /share/service/components/dashlets/my-sites.
It responded with a status of 500 - Internal Error.
Error Code Information: 500 - An error inside the HTTP server which prevented it from fulfilling the request.
Error Message: 05200001 Failed to execute script 'classpath*:alfresco/site-webscripts/org/alfresco/components/dashlets/my-sites.get.js': 05200000 05200001 Failed during processing of IMAP server status configuration from Alfresco: 05200000 Unable to retrieve IMAP server status from Alfresco: 404
Server: Alfresco Spring WebScripts - v1.2.0 (Release 1331) schema 1 000
Time: 20.06.2014 14:05:25

jpotts
World-Class Innovator
World-Class Innovator
I think that error is unrelated. Are there any errors earlier in the log?

Jeff