microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
733 stars 243 forks source link

RoleCenter-Extension Triggers don't work #4713

Closed JulianTillmann closed 5 years ago

JulianTillmann commented 5 years ago

Describe the bug We tried adding a new Activities Part to a RoleCenter. This Activities-Cardpart should only be shown if certain data is set. So we added a Visible-Boolean-Variable in the RoleCenter-PageExtension, changed the Visible-Property in the Part and set the variable in the OnOpenPage-Trigger.

image

But the PagePart is shown regardless of any Code in the OnOpen Page.

image

So we added a message to the OnOpenPage(Extension)-Trigger, but nothing's Happening. Same with the OnAfterGetRecord.

image

I've attached the whole ALProject

ActivityPageVisibleTest.zip

Versions:

qutreson commented 5 years ago

Hi @JulianTillmann, role centers in AL do not allow having triggers defined. When defining a new role center you would get the following diagnostics:

image

You would also get similar diagnostics when defining a trigger on page elements like in a field or an action.

It seems that we are missing some validation in page extensions that are targeting a page of type role center.

JulianTillmann commented 5 years ago

ok, we found out ourselves that Code in the RoleCenter-Triggers doesn't work in C/SIDE, but at least we get a Compiler error. Could you please see to that Validation in AL? Thanks in Advance

Also: how do you propose to solve this requirement? To dynamically set the visibility of a RoleCenter-Part?

qutreson commented 5 years ago

We will fix the missing validation from page extensions.

I do not know if there is an alternative that you can use to dynamically set the visibility of a part in a RoleCenter. Did you try posting your question in one of the following forums? Business Central Community Mibuso forum Dynamics User Group

JulianTillmann commented 5 years ago

I'm sorry, but I thought this was the place to find the Solutions for cloud Ready extensions for Business Central?

We are not interested in workarounds but would like to have a solution to this requirement within the AL standard.

qutreson commented 5 years ago

We will add to our backlog to investigate on the possibility to remove this restriction on role centers in future releases. We can use this issue to track it on Github.

qutreson commented 5 years ago

We added validation for triggers defined in Role Centers in our master branch (targeting Fall 2019) as well as some better validation around Role Centers in page and page extensions. Concerning the ability to define trigger code in Role Centers, please consider logging it on https://aka.ms/BusinessCentralideas, or vote up the idea if its already there. We're constantly monitoring top Ideas and will consider them for a future release.