AnsweredAssumed Answered

onActionFormDialog parameter

Question asked by robert.begin on Dec 16, 2013
Latest reply on Sep 4, 2014 by dab
How do I reference a parameter assigned on the onactionFormDialog from within the server side javascript ?

Here's my "share-custom-config.xml"


<!– Custom DocLibActions config section –>

<config evaluator="string-compare" condition="DocLibActions">
  <actions>
    <action id="my-document-new-publish" icon="publish" type="javascript" label="actions.mycompany.mynewpublish">
      <param name="function">onActionFormDialog</param>
      <param name="itemKind">action</param>
      <param name="itemId">my-newpublish-action</param>
      <param name="mode">create</param>
      <param name="destination">{node.nodeRef}</param>
      <param name="successMessage">message.mycompany.mynewpublish.success</param>
      <param name="failureMessage">message.mycompany.mynewpublish.failure</param>
    </action>
  </actions>

  <actionGroups>
    <actionGroup id="document-browse">
      <action index="366" id="my-document-new-publish" />
    </actionGroup>   
  </actionGroups>
</config>

<config evaluator="string-compare" condition="my-newpublish-action">
  <forms>
    <form>
      <field-visibility>          
        <show id="myTarget"/>
      </field-visibility>
      <appearance>
        <field id="myTarget" label="Choose destination">
          <control template="/org/alfresco/components/form/controls/selectone.ftl">
            <control-param name="options">0|Intranet,1|Public Site</control-param>
          </control>
        </field>
      </appearance>
    </form>
  </forms>
</config>


My "shared\classes\alfresco\extension\mynewpublish-context.xml"


?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
<bean id="my-newpublish-action" parent="script">
    <property name="scriptLocation">
        <bean class="org.alfresco.repo.jscript.ClasspathScriptLocation">
            <constructor-arg>
                <value>alfresco/extension/scripts/mynewpublish.js</value>
            </constructor-arg>
        </bean>
    </property>
</bean>
</beans>


So how do I reference the myTarget parameter from within my server-side javascript mynewpublish.js in order to get the expected 0 or 1 value ?

var ret = action.parameters["myTarget"];

does not work. Hard to find examples anywhere.

Outcomes