UICop Warning AW0014

Groups containing ActionRef targets should not be hidden.

Description

Actionrefs whose target actions are defined in a hidden group are still rendered on the promoted section of the command bar, but this behavior might change and these actionrefs might be hidden in the future. If you want to see these actions in the default section of the command bar, remove the Visible property on the group. If you do not want to see these actions on the promoted section of the command bar, remove the actionrefs.

Code example triggering the rule

The following code triggers a diagnostic from this rule because MyGroup is hidden, but MyPromotedAction is the target of an ActionRef.

page 50100 MyPage
{
    actions
    {
        area(Promoted)
        {
            actionref(MyActionRef; MyPromotedAction)
            {
            }
        }
        area(Creation)
        {
            group(MyGroup)
            {
                Visible = false;

                action(MyPromotedAction)
                {
                }
            }
        }
    }
}

The visibility of actionrefs depends on the visibility of their target actions. If the target action's Visible property is set to false, then the actionref is hidden too.

However, actionrefs actions are currently rendered on the promoted section of the command bar based on the Visible property set on the action and the actionref, without considering the actual visibility of their target action in the default section of the command bar.

MyPromotedAction doesn't have the visible property set, so it's visible by default and the promoted action will be rendered in the promoted section of the command bar. However, since MyGroup isn't visible, MyPromotedAction will also not be visible in the default section of the command bar.

Note

You can achieve a similar behavior by using the PromotedOnly property on MyPromotedAction.

How to fix this diagnostic?

There are three ways to fix this diagnostic depending on what you want to achieve:

1. Make the action group visible

page 50100 MyPage
{
    actions
    {
        area(Promoted)
        {
            actionref(MyActionRef; MyPromotedAction)
            {
            }
        }
        area(Creation)
        {
            group(MyGroup)
            {
                action(MyPromotedAction)
                {
                }
            }
        }
    }
}

There's no impact on the promoted section of the command bar as the actionref remains visible. However, promoted actions and non-promoted actions become visible in the default section of the command bar.

Use this approach if you want the group and its actions to be visible.

2. Remove the actionrefs for the actions in the group

page 50100 MyPage
{
    actions
    {
        area(Creation)
        {
            Visible = false;

            group(MyGroup)
            {
                action(MyPromotedAction)
                {
                }
            }
        }
    }
}

There's no impact on the default section of the command bar since all actions remain hidden by the group. However, the actionref no longer appears in the promoted section of the command bar. Use this approach if you didn't expect MyPromotedAction to appear in the promoted section of the command bar and you want to hide it completely.

Remark, in order to be compliant with the breaking change validation from the AppSourceCop, the following change is recommended:

page 50100 MyPage
{
    actions
    {
        area(Promoted)
        {
            actionref(MyActionRef; MyPromotedAction)
            {
                Visible = false;
                ObsoleteState = Pending;
                ObsoleteReason = 'Will be removed in a future version';
            }
        }
        area(Creation)
        {
            Visible = false;

            group(MyGroup)
            {
                action(MyPromotedAction)
                {
                }
            }
        }
    }
}

See Also

UICop Analyzer
Getting Started with AL
Developing Extensions