microsoft / ALAppExtensions

Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central.
MIT License
770 stars 610 forks source link

Report Extension - "<table variable> is inaccessible due to its protection level" #12661

Closed grantbrimhall closed 2 years ago

grantbrimhall commented 3 years ago

I tried my first report extension today, and was a bit disappointed. I wanted to add a column to the report, based on a table variable that was inside a dataitem. Many columns already exist in the report from that very table variable. But I was unable to add the column due to the table variables protection level. And being that the dataitem was a integer loop, I am aware of anyway to create a child data item based on any fields native to integer that would help me get the data I was after.

is this something that can be addressed in future release? is this the right forum to suggest it? thx.

StanPesotskiy commented 3 years ago

You can request to make global variables protected. It will make them accessible from the extension. Why don't you name the report and the variable you wanted to use in the extension?

grantbrimhall commented 3 years ago

this was as far as I got:

reportextension 52500 test extends "Aged Accounts Receivable" { dataset { add(TempCustLedgEntryLoop) { column(CLEDocumentDate; Format(CustLedgEntryEndingDate."Document Type")) { } } } }

and it said CustLedgEntryEndingDate was inaccessible.

is there some simple syntax I can add to use it?

StanPesotskiy commented 3 years ago

If we make CustLedgEntryEndingDate: Record "Cust. Ledger Entry"; protected it will be accessible. Any other variable to expose? You just need to list the variables that should become protected.

grantbrimhall commented 3 years ago

Hi Stan:

Thanks for your dialogue. This is really helpful! 😊

Is that something that could be done to all variables in all reports in the base application? Or are there instances where that would cause problems?

I can think of dozens of instances where I’ve had to copy the report to a 5xxxx object id … but if the variables were all protected, especially those variables inside of Integer loops, this would really increase the capability and power of the report extension.

Thanks.

-Grant

Grant Brimhall SENIOR ERP ARCHITECT O: 385.381.2822 | M: 801.717.5712 JourneyTEAM | www.journeyteam.comhttps://nam04.safelinks.protection.outlook.com/?url=www.journeyteam.com&data=02%7C01%7Cgrant.brimhall%40journeyteam.com%7C0d64a5c8884e43335d4e08d7c5154eab%7Cb59c07c69496463aab8177697ac73d11%7C1%7C0%7C637194568818019651&sdata=p25w61X7xEz2kxQ5op6W8AQjaTwqh7Q5%2B7ehnRN6lhA%3D&reserved=0

@.***D7592C.B51DC860]

From: Stan Pesotskiy @.> Sent: Friday, June 4, 2021 1:41 AM To: microsoft/ALAppExtensions @.> Cc: Grant Brimhall @.>; Author @.> Subject: Re: [microsoft/ALAppExtensions] Report Extension - "

is inaccessible due to its protection level" (#12661)

If we make CustLedgEntryEndingDate: Record "Cust. Ledger Entry"; protected it will be accessible. Any other variable to expose?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FALAppExtensions%2Fissues%2F12661%23issuecomment-854447169&data=04%7C01%7Cgrant.brimhall%40journeyteam.com%7C9a8856641f82493e989508d9272c0b73%7Cb59c07c69496463aab8177697ac73d11%7C1%7C0%7C637583892387706959%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MXtkEymvedsET9znpmzosLg3P3J7jcAekapn2Tl%2Bzkk%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPIUKZATHZ7APZYQYTM4ELDTRB7PJANCNFSM46BWQJEQ&data=04%7C01%7Cgrant.brimhall%40journeyteam.com%7C9a8856641f82493e989508d9272c0b73%7Cb59c07c69496463aab8177697ac73d11%7C1%7C0%7C637583892387716950%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=24OQnUNwiqAmkHFUqKk8c%2FMGVtRlCVArtKUep1msy9U%3D&reserved=0.

StanPesotskiy commented 3 years ago

There is no plan to add typical events to all reports. For now it works by request. You create a request per report and list variables that you want to expose.

dzzzb commented 3 years ago

Making everything protected by default means exposing way too many things for people to become dependent on, which means MS can't change/remove said variables later, which means they can't improve the base code in case someone complains. It makes far more sense to require requesting protection on individual variables, then MS can sense-check before making them so.

I requested TempCustLedgEntry here: https://github.com/microsoft/ALAppExtensions/issues/12579 I haven't yet checked whether/how any subsequent releases make that accessible. However, it was accepted, and so could yours be I would imagine.