AnsweredAssumed Answered

A value for the mandatory parameter <MYPARAM> has not been set on the rule <ID_RULE>

Question asked by 4535992 on Aug 11, 2017
Latest reply on Aug 11, 2017 by 4535992

In relation to the question getParametersValue is empty , i have built a surf extensions:

==================================================================

alfresco/web-extensions/site-data/extensions/my-module-actions-extension-modules

==================================================================

<extension>
    <modules>
        <module>
            <id>signed-as-aruba</id>
            <version>${project.version}</version>
            <auto-deploy>true</auto-deploy>
            <configurations>
                
                <config evaluator="string-compare" condition="DocumentLibrary">
                    <indicators>                       
                        <indicator id="indicator.isSigned"
                            icon="signed-doc-16.png"
                            index="100"
                            label="indicator.isSigned.label">
                            <evaluator>alfresco.evaluator.isSignable</evaluator>
                        </indicator>
                    </indicators>
                    
                    <toolbar-actions>
                          <action type="action-link" id="doclib.action.signedAsAruba" label="menu.selected-items.signedAsAruba" />
                      </toolbar-actions>

 

                </config>
                
                <config evaluator="string-compare" condition="DocLibActions">
                    <actions>

 

                        <action id="doclib.action.signedAsAruba"
                            icon="signed-doc-16.png"
                            type="javascript"
                            label="doclib.action.signedAsAruba.label">
                            <param name="function">onActionFormDialog</param>
                            <param name="itemKind">action</param>
                            <param name="itemId">signed-as-aruba</param> <!-- Repository action id = Spring Bean id -->
                            <param name="mode">create</param>
                            <param name="destination">{node.nodeRef}</param>
                            <param name="successMessage">sign.doclib.action.signed.msg.success</param>
                            <param name="failureMessage">sign.doclib.action.signed.msg.failure</param>
                            <evaluator>alfresco.evaluator.isSignable</evaluator>
                        </action>

 

                        <action id="sign.doclib.action.callWebScript"
                                icon="callws"
                                type="javascript"
                                label="sign.doclib.action.callWebScript.label">
                            <param name="active">true</param>
                            <param name="function">onActionCallWebScript</param>
                            <param name="successMessage">sign.doclib.action.callWebScript.msg.success</param>
                            <param name="failureMessage">sign.doclib.action.callWebScript.msg.failure</param>
                        </action>
                    </actions>

 

                    <actionGroups>
                        <actionGroup id="document-browse">
                            <action index="400" id="doclib.action.signedAsAruba" />
                        </actionGroup>
                        <actionGroup id="document-details">
                            <action index="400" id="doclib.action.signedAsAruba" />
                        </actionGroup>

 

                        <actionGroup id="folder-browse">
                            <action index="400" id="doclib.action.signedAsAruba" />
                        </actionGroup>
                    </actionGroups>
                </config>

 

                <config evaluator="string-compare" condition="DocLibCustom">
                    <dependencies>
                        <js src="components/documentlibrary/custom-doclib-actions.js" />
                    </dependencies>
                </config>

 

                <!-- ====== -->
                <!-- FORMS  -->
                <!-- ====== -->
                <config evaluator="string-compare" condition="signed-as-aruba">
                    <forms>
                        <form>
                            <field-visibility>
                                <show id="my_form_sign_firma.otp"/>
                                <show id="my_form_sign_firma.luogo"/>
                                <show id="my_form_sign_firma.motivo"/>
                                <show id="my_form_sign_firma.username"/>
                                <show id="my_form_sign_firma.password"/>
                            </field-visibility>
                            <appearance>
                              <field id="my_form_sign_firma.otp" label-id="property.form.sign.my_form_sign_firma.otp">
                                  <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                              </field>    
                              <field id="my_form_sign_firma.luogo" label-id="property.form.sign.my_form_sign_firma.luogo">
                                  <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                              </field>                                                        
                              <field id="my_form_sign_firma.motivo" label-id="property.form.sign.my_form_sign_firma.motivo">
                                    <control template="/org/alfresco/components/form/controls/textarea.ftl" />
                              </field>
                              <field id="my_form_sign_firma.username" label-id="property.form.sign.my_form_sign_firma.username">
                                    <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                              </field>
                              <field id="my_form_sign_firma.password" label-id="property.form.sign.my_form_sign_firma.password">
                                    <control template="/org/alfresco/components/form/controls/textfield.ftl" />
                              </field>                                  
                            </appearance>
                        </form>
                    </forms>
                </config>  
            </configurations>
        </module>
    </modules>
</extension>

===============================================================

 

,while in my repo project i have set:

 

==================================================================

alfresco/module/mymodule/context/webscript-context.xml

or

alfresco/module/mymodule/context/action-context.xml

==================================================================

   <bean id="signed-as-aruba" class="my.module.actions.SignAction.java" parent="action-executer">
        <property name="contentService">
            <ref bean="ContentService"/>
        </property>
        <property name="nodeService">
            <ref bean="NodeService"/>
        </property>
        <property name="configurazioniBean">
            <ref bean="configurazioniBeanCompleto" />
        </property>
    </bean>

============================================================

when  i start share and click on the label of the custom action on the right menu of the content, i 'm correctly redirect to the class java action i have realized:

================================================================

my.module.actions.SignAction.java

================================================================

public class SignAction extends ActionExecuterAbstractBase  {
    private static Log logger = LogFactory.getLog(SignAction.class);
    
    private ContentService contentService;
    private NodeService nodeService;
    
    private ConfigurazioniBean configurazioniBean;
    
    @SuppressWarnings("unchecked")
    @Override
    protected void executeImpl(Action action, NodeRef actionedUponNodeRef)  {
        logger.debug("START SERVICE SignAction#executeImpl");
        try {        
            if (action.getParameterValues() == null || action.getParameterValues().size() == 0) {
                throw new Exception("NO parameters value are arrived here");//HERE THROW THE EXCEPTION
            }
            logger.debug("END SignAction#executeImpl");
        } catch (Throwable t) {
            throw new RuntimeException("Something is wrong",t);
        }
    }

 

    @Override
    protected void addParameterDefinitions(List<ParameterDefinition> paramList) {

         paramList.add(new ParameterDefinitionImpl("my_form_sign_firma.otp", DataTypeDefinition.TEXT, true, getParamDisplayLabel("my_form_sign_firma.otp")));
        paramList.add(new ParameterDefinitionImpl("my_form_sign_firma.luogo", DataTypeDefinition.TEXT, true, getParamDisplayLabel("my_form_sign_firma.luogo")));        
        paramList.add(new ParameterDefinitionImpl("my_form_sign_firma.motivo", DataTypeDefinition.TEXT, true, getParamDisplayLabel("my_form_sign_firma.motivo")));
        paramList.add(new ParameterDefinitionImpl("my_form_sign_firma.username", DataTypeDefinition.TEXT, true, getParamDisplayLabel("my_form_sign_firma.username")));
        paramList.add(new ParameterDefinitionImpl("my_form_sign_firma.password", DataTypeDefinition.TEXT, true, getParamDisplayLabel("my_form_sign_firma.password")));

    }

 

    public void setContentService(ContentService contentService) {
        this.contentService = contentService;
    }

 

    public void setNodeService(NodeService nodeService) {
        this.nodeService = nodeService;
    }

 

    public void setConfigurazioniBean(ConfigurazioniBean configurazioniBean) {
        this.configurazioniBean = configurazioniBean;
    }
}

================================================================

i fill the form alfresco "popup" when click on the custom action label and click on the ok button for send the post of the form to my action java, but it's return always the error "A value for the mandatory parameter "my_form_sign_firma.otp" has not been set on the rule "signed-as-aruba"" o any other  field of the form.

whar i'm doing wrong? i don't understand this error !

Outcomes