on 10-19-2016 10:35 AM
hi! Maybe you know how disable action button in backoffice after action.
action : y:action action-id=".....SendEmailToClientData" property="currentObject"
action is performed only once, after this button must be switched off (disabled)
Hi,
An action defines an attribute 'property' in its config.xml. This points to a key in widget model. Whenever a value of this property is changed, action component is reloaded. In this way combining with solution suggested by Łukasz you may achieve what you want. In other words: implement #canPerform in a way that you check i.e. "executed" property in widget model - it it exists and contains Boolean.TRUE value, then you return false. Then you bind action to "executed" property. Finally you set "executed" to Boolean.TRUE, when the action is executed.
Cheers, Jacek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One more problem:
I guess action needs whole item to properly execute its logic. It is still available via action parameters - there is a parameter called com.hybris.cockpitng.actions.ActionContext#PARENT_WIDGET_MODEL from which you still may access com.hybris.cockpitng.core.model.StandardModelKeys#CONTEXT_OBJECT.
Second guess: email should be sent only once per lifetime of item. If so, then it needs to be stored in item model (remember to flush changes on action perform) and you should set action's property to i.e. "currentObject.emailSent".
Best regards, Jacek
Hi,
You can disable action by 'canPerform' method. In order to do this, 'canPerform' has to return false. In your case this method would need to check whether action has been invoked. If so, the method will have to return 'false'.
Regards
Lukasz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.