MJSalinas
MJSalinas

Reputation: 139

How do you show dynamic messages on custom actions?

I have a working custom action set up like this in the share-config-custom.xml

<action id="deploy-asset-qa" type="javascript" label="Deploy File to QA..." icon="document-move-to">
    <param name="function">onActionSimpleRepoAction</param>
    <permissions>
        <permission allow="true">Write</permission>
    </permissions>
    <param name="action">deploy-asset-qa</param>
    <param name="successMessage">message.deployment-success-qa</param>
    <param name="failureMessage">message.deployment-failure-qa</param>
</action>

This works great, but this only shows the hard coded messages if it was a success or a failure.

I would like to present the user with more dynamic error messages that give good feed back.

How do you show dynamic messages on custom actions?

I am using Alfresco Community 5.0.d

Upvotes: 2

Views: 625

Answers (1)

Sanjay
Sanjay

Reputation: 2493

Yes you can do this. Try below steps. I am giving generic scenario that you can apply in your case.

1)From Share UI, I click on custom action
2)This action will call your Repo data webscript to check datatype OR whatever is your logic.
3)You can define specific Success/Failure message as part of your data webscript's JSON response.
4)You can access this response and so this custom message in Share client side js
5)Display this message to users.

For Failure I would suggest You can add, specific template file with failure status code and Failure message.
Ex: customAction.get.json.500.ftl  , customAction.get.json.400.ftl etc..

Hope it helps!

Upvotes: 0

Related Questions