AnsweredAssumed Answered

Bean is not recognized

Question asked by theobroma on Dec 7, 2017
Latest reply on Dec 12, 2017 by theobroma

I have configured new multi-select button in the document library:

 

 

 

 

When the button is clicked it should execute javascript function onActionAddToList which later calls bean function. Everything works except bean function insert, it is not called/recognized since listManagement is not found. Am I doing something wrong? I am wondering if I should configure bean in an other place? I'm using Alfresco 5.2.0 SDK 3.0.1 Below you can find corresponding code:

 

1. /alfresco/web-extension/site-data/extensions/my-extension.xml   -> share-jar

<configurations>
   <config evaluator="string-compare" condition="DocumentLibrary">
      <multi-select>
         <action type="action-link" id="onActionAddToList" icon="document-approve" label="Add item to a list" />
      </multi-select>
   </config>
   <config evaluator="string-compare" condition="DocLibCustom" replace="true">
      <dependencies>
         <js src="/components/documentlibrary/custom-documentlibrary-actions.js" />
      </dependencies>
     </config>
</configurations>

 

2. resources/components/documentlibrary/custom-documentlibrary-actions.js ->  share-jar

YAHOO.Bubbling.fire("registerAction", {
   actionName: "onActionAddToList",
   fn: function custom_onActionAddToList(record)
      {
         Alfresco.util.PopupManager.displayMessage({ title: "Info", text: listManagement.insert("Hello")});
      }
});

 

3. alfresco/module/project/context/service-context.xml -> platform-jar

<beans>
   <bean id="com.test.actions.ListManagement" class="com.test.actions.ListManagement"       parent="baseJavaScriptExtension">
      <property name="extensionName" value="listManagement"/>
    </bean>
</beans>

 

4. java/com/test/actions/ListManagement.java -> platform-jar

public class ListManagement extends BaseProcessorExtension {

   public String insert(String text) {

      return text;
}

Outcomes