Skip to Content

How can I disable button in backoffice when make action with another button?

Hi experts how can I disable button action in backoffice when make action with another button?

For example when I create order from storefront then in backoffice in orders tab for current order i have 2 action button. APROVE and REJECT.

alt text

When approve order I still see Reject button. How can disable this button after approve? alt text

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Feb 20, 2019 at 02:42 PM

    Hi ,

    Actions are re-rendered when a specified value in model changes (`property` attribute in configuration of an action). What I would do is that I would steer it with some value in widget model (e.g. approvalStatus):

    • set this key as a property of those actions (i.e. property="approvalStatus"),

    • check this value in action's canPerform method (it will be available via com.hybris.cockpitng.actions.ActionContext#getData)

    • set this value in action's perform method (widget instance manager is available under wim key in action context)

    It should solve your problem.

    Cheers, Jacek

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 21, 2019 at 01:54 PM

    Hi can you give me a simple code how to get widget instance manager? Thank you :)

    I created custom action for approve button, but Reject is OOB button just renamed Cancel -> Reject and is there a way to do something like this. Check what is order status:

       if ( actionContext.getData().getStatus().equals("Approved") ) {
             //here set on Reject ( Cancel ) button merge-mode="Remove" or return true ?
        }
    
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.