cancel
Showing results for 
Search instead for 
Did you mean: 

Custom action not working

darkredd
Star Contributor
Star Contributor
Hi all,

I am trying to create a share action, followed a few tutorials and famously Jeff Potts's creating custom action tutorial <a href="http://ecmarchitect.com/alfresco-developer-series-tutorials/actions/tutorial/tutorial.html#example-1...">here</a> to no effect. Here is my share-config file:

1. share-config

   <config evaluator="string-compare" condition="DocLibActions">
  
      <actions>
         <action id="bubble-action" type="javascript" label="Bubble Action">
            <param name="function">onActionSimpleRepoAction</param>
            <param name="action">bubble-click</param>
         </action>
      </actions>
      
      <actionGroups>
    
         <actionGroup id="document-browse">
            <action index="300" id="bubble-action" />
         </actionGroup>
      
      <actionGroup id="document-details">
            <action index="340" id="bubble-action" />
      </actionGroup>
      
      </actionGroups>
   </config>


The button appears on share but does nothing when clicked. I suspect my wiring is wrong. Or maybe I just went about this the wrong way.
8 REPLIES 8

sammasue
Champ in-the-making
Champ in-the-making
Hello,

I've got a similar effect when the action bean id was different than the action name in the share config:


<!– Spring context: custom bean action definition–>
<bean id="bubble-click" class="somepath/YourAction.java" parent="action-executer"/>

<!– share custom config: the name of the action should be equals to the id of your bean –>
<param name="action">bubble-click</param>



If it's not the cause of your error, I've got no idea.

darkredd
Star Contributor
Star Contributor
Hello Sam,

The bean id is the same. This is a strange thing though.


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
   <!– Add aspect custom action –>
   <bean id="bubble-click" class="za.gov.parliament.customActions.BubbleClick" parent="action-executer">
      <property name="publicAction">
         <value>false</value>
      </property>
   </bean>
</beans>


Thanks for the reply, I will continue to look for a solution still.

sammasue
Champ in-the-making
Champ in-the-making
It would have been too easy if it was that.

Otherwise you could check that the action indexes are not in conflict with others (E.g. share-documentlibrary-config.xml)


<!– an example of existing action–>
<action index="110" id="document-view-content" />


But I'm not sure it has a real impact if you put two actions with the same index, it probably just take the last one in the list.

I notice you set publicAction to false, have you tried to keep the default value which is true (I'm not sure about this boolean).

Public action only makes it available in the Rule config drop down list, which works from there. I have tried it even after clearing Alfresco's cache still no luck.

angelborroy
Community Manager Community Manager
Community Manager
Have your
za.gov.parliament.customActions.BubbleClick
any parameter?
Hyland Developer Evangelist

It takes no parameters. All it has to do is print a message to the log file, logic will be added once the button is clickable.

PS: The action works if invoked as part of a rule and also as a javascript action i.e. actions.create("bubble-click").

angelborroy
Community Manager Community Manager
Community Manager
If invoked as a part of a rule or if invoked as a JavaScript action have no connection with Share webapp. The problem seems to be that Share does not find
bubble-click
action. If there are no params, the action ID is right and no client JavaScript error is thrown, it must be parameters in the definition. Try to complete declaration with:

<param name="successMessage">Success</param>
<param name="failureMessage">Failure</param>
Hyland Developer Evangelist

Omission of those two lines was the issue, it now works.
Lesson learned.