Hi all,
I am currently trying to add an extra field to the "Item" table - displaying that field on the "Item Card" page via an AL extension. If I just add the field to the table the extension deploys to my sandbox successfully. The code I'm using is virtually a direct copy from the documentation at: https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-page-ext-object
When I attempt to deploy (Ctrl F5) the extension it gives me the error "error AL0118: The name 'MyField' does not exist in the current context." - which is referring to the "field" entry in the pageextension - i.e. It cannot find the field I created in my table extension.
If I change the "expression" portion of that statement to a literal value (e.g. 12345) then the field displays as expected (read only with the literal value in it). What am I missing (seems like it shouldn't be this hard to get it to work). I've even tried copying the "ShoeSize" code from the above link and it too doesn't exist.
Using latest AL extension in VSCode. Cloud based BC (all up to date).
Not sure if there's a specific Dev forum I should be posting this in - please redirect me if there is.
Thanks,
Scott S.
tableextension 50100 ItemTableExtension extends Item { fields { field(50101; MyField; Text[50]) { Caption = 'My Field'; } } } pageextension 50102 ItemCardExtension extends "Item Card" { layout { // Add changes to page layout here addlast(Item) { field("My Field"; MyField) { ApplicationArea = All; } } } }
That was exactly it! Thanks!
I did look at the "NoImplicitWith" page but didn't see anything that made me think it applied to my issue.
Hi, if your Sandbox is BC21, I think you just missed "Rec.".
For example,
More details: Business Central 2022 wave 2 (BC21) new features: Enable NoImplicitWith feature by default (New feature setting in app.json file)
Hope this helps.
Thanks.
ZHU
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,232 Super User 2024 Season 2
Martin Dráb 230,064 Most Valuable Professional
nmaenpaa 101,156