When we try to add a new option in Mass Actions for CMS pages and blocks, child options do not work as expected.
When in Catalog/Products we can choose "Actions/Change Status" and than two items appear "Enable/Disable".
We cannot replicate this behavior in CMS pages/blocks.
````
Tested in a Magento app skeleton
@bvboas Changing page and blocks status happens from the grid column. Pagers are different from Products

Hi @tkacheva ,
Changing status was an example of a possible mass actions with children elements we would like to add.
We want to select a few or all blocks/pages and duplicate them or copying them to another store view. The process would be: Select the desired pages, go to the actions menu, choose "Copy to Store View" and then in a submenu list the existing store views. That is currently not achievable
Thanks
@bvboas Now it's clear what you want to achieve. @que-etc will look into it.
Hi, @bvboas.
There is just one tweak you need to make. Swap out the default MassActions component (Magento_Ui/js/grid/massactions) for the one that handles nested actions.
So, the resulting config will look like the following:
<listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<listingToolbar name="listing_top">
<massaction name="listing_massaction">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/grid/tree-massactions</item>
</item>
</argument>
<action name="status">
<!-- ... -->
</action>
</massaction>
</listingToolbar>
</listing>
@que-etc Thanks. That did it.
I spoke too soon ...
If you have two items in the dropdown that have childrens and you click on the second, the displayed confirmation message and post params will be from the first one.
open the file customer_listing.xml
Duplicate the action "assign_to_group"
<action name="assign_to_group">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="type" xsi:type="string">assign_to_group</item>
<item name="label" xsi:type="string" translate="true">Assign a Customer Group</item>
</item>
</argument>
<argument name="actions" xsi:type="configurableObject">
<argument name="class" xsi:type="string">Magento\Customer\Ui\Component\MassAction\Group\Options</argument>
<argument name="data" xsi:type="array">
<item name="urlPath" xsi:type="string">customer/index/massAssignGroup</item>
<item name="paramName" xsi:type="string">group</item>
<item name="confirm" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Assign a Customer Group</item>
<item name="message" xsi:type="string" translate="true">Are you sure to assign selected customers to new group?</item>
</item>
</argument>
</argument>
</action>
<action name="assign_to_group_duplicated">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="type" xsi:type="string">assign_to_group_duplicated</item>
<item name="label" xsi:type="string" translate="true">Assign a Customer Group Duplicated</item>
</item>
</argument>
<argument name="actions" xsi:type="configurableObject">
<argument name="class" xsi:type="string">Magento\Customer\Ui\Component\MassAction\Group\Options</argument>
<argument name="data" xsi:type="array">
<item name="urlPath" xsi:type="string">customer/index/massAssignGroup</item>
<item name="paramName" xsi:type="string">group</item>
<item name="confirm" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Assign a Customer Group Duplicated</item>
<item name="message" xsi:type="string" translate="true">Are you sure to assign selected customers to new group Duplicated?</item>
</item>
</argument>
</argument>
</action>
When clicking on the child elements from the duplicated massAction, the message that shows up is from the first massAction
Yep, I can confirm it. I'll create an internal ticket. Thanks!
Internal tickets MAGETWO-70294 / MAGETWO-70295.
@bvboas So, I've found out what causes this bug. It happens when some actions have the same value of the type property. And this is related not only to elements on the same level but also to those which are located in parallel nodes or somewhere else in a hierarchy.
<action name="actions_name">
<!-- ... -->
<argument name="actions" xsi:type="array">
<item name="0" xsi:type="array">
<item name="type" xsi:type="string">enable</item>
<item name="label" xsi:type="string" translate="true">Enable</item>
</item>
<item name="1" xsi:type="array">
<item name="type" xsi:type="string">disable</item>
<item name="label" xsi:type="string" translate="true">Disable</item>
</item>
</argument>
</action>
<action name="actions_name_duplicated">
<!-- ... -->
<argument name="actions" xsi:type="array">
<item name="0" xsi:type="array">
<!-- action with the type "enabled" is already present in the parallel node -->
<item name="type" xsi:type="string">enable</item>
<item name="label" xsi:type="string" translate="true">Enable</item>
</item>
<item name="1" xsi:type="array">
<item name="type" xsi:type="string">disable</item>
<item name="label" xsi:type="string" translate="true">Disable</item>
</item>
</argument>
</action>
Thus, as a makeshift solution until we deliver the fix, you can ensure that all actions have a unique type value.
@que-etc thanks. added a workaround and works.
@bvboas, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.1.9
Most helpful comment
@bvboas So, I've found out what causes this bug. It happens when some actions have the same value of the
typeproperty. And this is related not only to elements on the same level but also to those which are located in parallel nodes or somewhere else in a hierarchy.Thus, as a makeshift solution until we deliver the fix, you can ensure that all actions have a unique type value.