cancel
Showing results for 
Search instead for 
Did you mean: 

[solved] my custom action is not triggered

ethan
Champ in-the-making
Champ in-the-making
Hello : )

I created a custom action attached to a custom model of document. I can launch the action by running it through the Run Action Menu but it doesn't work when I click on the action link I added in the doc_details_actions action group. I used the debug mode and put breakpoints to check the use of my custom action. they are triggered when I use the Run Action menu but with the action link, they aren't…

Here is the configuration of the action in my \alfresco\WEB-INF\classes\alfresco\extension\web-client-config-custom.xml file :


<action id="download-file">
   <permissions>
      <permission allow="true">Read</permission>
   </permissions>
   <label-id>download-file</label-id>
   <image>/magillem/images/icons/download.gif</image>
   <action>download-file</action>
</action>
And here is the bean configuration in my \alfresco\WEB-INF\classes\alfresco\extension\download-file-action-context.xml :


<beans>
     
    <!– Download Action Bean –>
    <bean id="download-file" class="my.alfresco.customUI.actions.DownloadActionExecuter" parent="action-executer">
       <property name="nodeService">
         <ref bean="NodeService" />
      </property>
      <property name="jcrServerIP" value="localhost:8080" />
      <property name="exchangeServerIP" value="192.168.20.241" />
      <property name="fileServerIP" value="192.168.20.151" />
      <property name="exchangeLogin" value="testUser" />
      <property name="exchangePassword" value="password" />
      <property name="publicAction">
           <value>true</value>
         </property>
   
   </bean>
  
      <!– Action properties –>
   <bean id="extension.actionResourceBundles" parent="actionResourceBundles">
      <property name="resourceBundles">
         <list>
            <value>alfresco.extension.download-file-action-messages</value>
         </list>
      </property>
   </bean>   
</beans>

Do you have any idea of what I am missing?

Thank you : )
3 REPLIES 3

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
Hi, for executing actions from browser i user this configuration,
define bean where from I call my action like this in your case.

UIActionLink link = (UIActionLink) actionEvent.getComponent();
      Map<String, String> params = link.getParameterMap();
      String ref = params.get("ref");
      NodeRef nodeRef = new NodeRef(ref);

      ActionService actionService = org.alfresco.web.bean.repository.Repository.getServiceRegistry(FacesContext.getCurrentInstance()).getActionService();
      org.alfresco.service.cmr.action.Action action = actionService.createAction("download-file");
      actionService.executeAction(action, nodeRef);

<action id="download_file">
            <label-id>actionexecute</label-id>
            <image>/images/filetypes/pic.gif</image>
            <action-listener>#{MyBean.executeAction}</action-listener>
            <params>
               <param name="ref">#{actionContext.nodeRef}
               </param>
               
            </params>
         </action>

this is extra 5 min of work and works great.

ethan
Champ in-the-making
Champ in-the-making
Thank you for your help Smiley Very Happy It works great Smiley Happy

inocka
Champ in-the-making
Champ in-the-making
Hi,
I also try to implement custom action which should call search with predefined parameters and redirect to browse.jsp.
Tanks for any help