cancel
Showing results for 
Search instead for 
Did you mean: 

DocLibAction not returning form values

_jan
Champ on-the-rise
Champ on-the-rise
Hello,
I created new
DocLibAction
according to this site http://blog.arvixe.com/add-custom-action-in-alfresco-share/. But in Java action I am not able to get values from form and node of action is
null
. When I try to write down
Action
variable, result is
Action[ id=a951d684-1caf-48a8-a142-c646cfda10bd, node=null ]
.

share-custom-config.xml

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

<config evaluator="string-compare" condition="DocLibActions">
  <actions>
    <action id="document-tagging" type="javascript" label="actions.document.tagging" icon="folder-move-to">
      <param name="function">onActionFormDialog</param>
      <param name="itemKind">action</param>
      <param name="itemId">doc-tagging</param>
      <param name="mode">create</param>
      <param name="destination">{node.nodeRef}</param>
      <param name="successMessage">message.tagging.success</param>
      <param name="failureMessage">message.tagging.failure</param>   
    </action>
  </actions>
  <actionGroups>
    <actionGroup id="document-browse">
      <action index="370" id="document-tagging" />
    </actionGroup>
    <actionGroup id="document-details">
      <action index="400" id="document-tagging" />
    </actionGroup>
  </actionGroups>
</config>


service-context.xml

<bean id="doc-tagging" class="com.mycompany.cms.action.DocumentTaggingActionExecuter" parent="action-executer">
  <property name="nodeService">
    <ref bean="NodeService" />
  </property>
</bean>


and DocumentTaggingActionExecuter.java

public class DocumentTaggingActionExecuter extends ActionExecuterAbstractBase {
  private NodeService nodeService;
  public void setNodeService(NodeService nodeService) {
    this.nodeService = nodeService;
  }
  protected void executeImpl(Action action, NodeRef arg1) {
    System.out.println("action: "  + action.toString());
    System.out.println("tagname = " + (String) action.getParameterValue("tagname"));      
  }
  protected void addParameterDefinitions(List<ParameterDefinition> arg0) {}
}

And this DocumentTaggingActionExecuter action result is

action: Action[ id=a951d684-1caf-48a8-a142-c646cfda10bd, node=null ]
tagname: null
2 REPLIES 2