cancel
Showing results for 
Search instead for 
Did you mean: 

How to define custom action in alfresco share

forrest43
Champ in-the-making
Champ in-the-making
As per the instruction in book Developing Custom Actions 2 edition(http://ecmarchitect.com/images/articles/alfresco-actions/actions-article-2ed.pdf) , I create an action, and deploy this action in the Share. Then I need a pop up window for the end user to fill some information before the active start(which do not be describe in details in the book), how to achieve ?
do you have any tutorials to show me the step by step instruction?
4 REPLIES 4

forrest43
Champ in-the-making
Champ in-the-making
define in the share-config-custom.xml as follow:

    <config evaluator="string-compare" condition="action-asign-form">
         <forms>
              <form>
                 <field-visibility>
                     <show id="comment"/>
                 </field-visibility>
                 <appearance>
                     <field id="comment" label-id="erry.comment">
                         <control template="/org/alfresco/components/form/controls/textarea.ftl" />
                     </field>
                 </appearance>
            </form>
        </forms>
    </config>

<!– Actions –>
    <config evaluator="string-compare" condition="DocLibActions">
        <actions>
            <action id="erry-sign" type="javascript" label="actions.erry-sign" icon="erry-sign">
                <param name="function">onActionFormDialog</param>
                <param name="itemKind">action</param>
              <param name="itemId">action-asign-form</param>
                <permissions>
                    <permission allow="true">Write</permission>
                </permissions>
                <param name="action">signAction</param>
                <param name="successMessage">message.sign.disabled</param>
                <param name="failureMessage">message.sign.failure</param>
                <evaluator>erry.evaluator.doclib.action.signHistory</evaluator>
            </action>
        </actions>
        <actionGroups>
            <actionGroup id="document-browse">
                <action index="500" id="erry-sign" />              
            </actionGroup>
            <actionGroup id="document-details">
                <action index="500" id="erry-sign" />              
            </actionGroup>
        </actionGroups>       
    </config>

the form only have title bar with no form body where the fields should be located. The log said "a form could not be found for item : [action]action-asign-form". Did I miss something ?
Thank you

julian
Champ in-the-making
Champ in-the-making
If your action is signAction (define in model-context.xml or custom-model-context.xml) you have to write this:
Remove the line <param name="action">signAction</param>
Modifie <param name="itemId">action-asign-form</param> by <param name="itemId">signAction</param>
Change the condition of the form by signAction

    <config evaluator="string-compare" condition="signAction">
         <forms>
              <form>
                 <field-visibility>
                     <show id="comment"/>
                 </field-visibility>
                 <appearance>
                     <field id="comment" label-id="erry.comment">
                         <control template="/org/alfresco/components/form/controls/textarea.ftl" />
                     </field>
                 </appearance>
            </form>
        </forms>
    </config>

<!– Actions –>
    <config evaluator="string-compare" condition="DocLibActions">
        <actions>
            <action id="erry-sign" type="javascript" label="actions.erry-sign" icon="erry-sign">
                <param name="function">onActionFormDialog</param>
                <param name="itemKind">action</param>
           <param name="itemId">signAction</param>
                <permissions>
                    <permission allow="true">Write</permission>
                </permissions>
                <param name="successMessage">message.sign.disabled</param>
                <param name="failureMessage">message.sign.failure</param>
                <evaluator>erry.evaluator.doclib.action.signHistory</evaluator>
            </action>
        </actions>
        <actionGroups>
            <actionGroup id="document-browse">
                <action index="500" id="erry-sign" />              
            </actionGroup>
            <actionGroup id="document-details">
                <action index="500" id="erry-sign" />              
            </actionGroup>
        </actionGroups>       
    </config>


I hope it helps,

Julian

vicmutish
Champ in-the-making
Champ in-the-making
Followed all the tutoruials on how to add a custom action with a form popup bt am still getting the same error
: [scripts.forms.FormUIGet] [http-bio-8081-exec-66] org.alfresco.repo.forms.FormNotFoundException: 04210102 A form could not be found for item: [action]doc-tagging.

I have not create the java class for the action but i have included in the -context.xml file. Anything am missing. Kindly assist for anyone who has a solution to this.

krups
Champ in-the-making
Champ in-the-making
you must have bean defined for your action in your *-context.xml file as below

<bean id="action-asign-form" class="path of the class file in which you have implemented your action executer" parent="action-executer">
       
        <property name="nodeService">
            <ref bean="NodeService" />
        </property>
     
    </bean>

Hope this works.