Hi,
I have a requirement where I have to hide a custom action specified in an addon that I am using in my code. The action is required for a rule but I want to hide the action from users in document library and document preview page. I have tried the below way to hide the action but so far I am not successful.
The action bean-id defined in the addon service-context.xml that I want to hide - ev-ocr-english
Below is what I am trying to do in share-config-custom.xml under {classpathRoot}/alfresco/web-extension
<alfresco-config>
<config evaluator="string-compare" condition="DocLibActions">
<actions>
<action id="ev-ocr-english">
<evaluator>evaluator.doclib.action.disableAction</evaluator>
</action>
</actions>
</config>
</alfresco-config>
The above does nothing but if add replace="true" in the config tag above all the actions in the document preview page are hidden.
Please suggest a way on how to hide the custom action.
Thanks
Hiten Rastogi.
Solved! Go to Solution.
Hello.
You simply have to create a custom evaluator that checks the property's value, something like this (into the share "-context.xml" file):
<bean id="evaluator.doclib.isEmAnaliseDestinatario" parent="evaluator.doclib.action.value">
<property name="accessor" value="node.properties.san:statusDocumentoExterno" />
<property name="comparator">
<bean class="org.alfresco.web.evaluator.StringEqualsComparator">
<property name="value" value="Em Análise Destinatário" />
</bean>
</property>
</bean>
And then, in the action config, you use it, like (in the share-config-custom.xml file):
<action id="destinatario-rejeitar" type="javascript" label="Rejeitar"
icon="document-reject">
<evaluator>evaluator.doclib.isEmAnaliseDestinatario</evaluator>
<param name="function">onActionSimpleRepoAction</param>
<param name="action">destinatario-rejeitar-action</param>
<param name="successMessage">Rejeitado</param>
<param name="failureMessage">Problema ao executar ação</param>
</action>
Hello.
Do you have the source code for this addon?
If you do, why not to simply comment the block where the action is defined?
If you do not have the source code, you can try to copy the full block from the Share's code and change only what you need.
Thanks for the input Douglas. This action was in a addon and I didn't have access to the source code. I did what you have mentioned in the last but somehow I was not able to hide the action.
Hey.
If you have the AMP files, then you can extract the share configuration files from it, as it is a zip file with a different extension.
Try that and let me know if it works.
Hi Douglas,
Sorry for the late reply.
I was able to successfully hide the action by extracting the share configuration file and commenting out the relevant action and then putting back file in the amp.
Now, I am confronted with almost similar situation. I have to override the simple workflow's Approve and Reject action, I want them to only appear when the document has some comments in it.
How can I now override the simple workflow's Approve and Reject action with bean id document-approve and document-reject resp. so that I can add my custom evaluator that check for the comments ??
I was thinking of three things.
Can you please help me out with this.
Thanks
Hiten Rastogi
Hello.
You simply have to create a custom evaluator that checks the property's value, something like this (into the share "-context.xml" file):
<bean id="evaluator.doclib.isEmAnaliseDestinatario" parent="evaluator.doclib.action.value">
<property name="accessor" value="node.properties.san:statusDocumentoExterno" />
<property name="comparator">
<bean class="org.alfresco.web.evaluator.StringEqualsComparator">
<property name="value" value="Em Análise Destinatário" />
</bean>
</property>
</bean>
And then, in the action config, you use it, like (in the share-config-custom.xml file):
<action id="destinatario-rejeitar" type="javascript" label="Rejeitar"
icon="document-reject">
<evaluator>evaluator.doclib.isEmAnaliseDestinatario</evaluator>
<param name="function">onActionSimpleRepoAction</param>
<param name="action">destinatario-rejeitar-action</param>
<param name="successMessage">Rejeitado</param>
<param name="failureMessage">Problema ao executar ação</param>
</action>
Thanks Douglas,
Your suggested way worked.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.