cancel
Showing results for 
Search instead for 
Did you mean: 

Disable backoffice action button

Former Member
0 Kudos

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)

View Entire Topic
former_member625836
Active Contributor
0 Kudos

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

former_member625836
Active Contributor
0 Kudos

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