NoImplicitWith – The name #FieldName does not exist in the current context

If you have used WITH statement in your AL code to make the code readable, then this blog will be helpful for you. There are people who completely support the use of WITH statement and I also was on that category a few years ago. Fortunately, I moved on from the use of WITH statements.

Fortunate because Microsoft recently announced that they are planning to obsoleting the WITH statement and currently this comes as a warning if you try to compile your AL extension.

Use of implicit 'with' will be removed in the future. Qualify with 'Rec.'. This warning will become an error in a future release.AL(AL0604)

Reason for this breaking (in near future) change is that, WITH statement create un-efficiency during compilation and Microsoft wants to stop this in going forward. Current warning will become an error in one years time so it is better to start fixing the warnings and stop using WITH statement anymore in your new code .

If you want to stop your developers using WITH statement in future you can add “NoImplicitWith” as a “features” to your app.json file. This will change all the warnings into errors and will not allow anyone using WITH statement anymore.

As soon as you add the NoImplicitWith to the app.json file, you will get errors like below. Probably you will have around hundreds of errors which needs your attention.

If you want to fix them manfully, you can change the code like below and error will go away.

There is an extension that helps you to fix the NoImplicitWith errors and please refer my next blog to read about it.

Please provide your feedback with a comment. 
Thank you and Regards,
Tharanga Chandrasekara

Click on a star to rate it!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.