4
In generic code, we often need to do something like:

CallSomeGenericFunction(Database::Customer, Customer.FieldNo(Name))

The problem with this is that to get the FieldNo, we need a local Customer: Record variable. Often that is the only thing said rec is needed for. So having to declare it is boilerplate, and invites accidental use of the var later.

Can it be possible with some AL magic to avoid this, and be able to write that instead as:

CallSomeGenericFunction(Database::Customer, SystemFuncToGetFieldNo(Database::Customer, Name))

...where `Name` is looked up within the scope of Database::Customer and resolved at compile-time?

Even better would be to avoid the duplication of the table ID and just do something like:

CallSomeGenericFunction(SystemFuncToGetSuperFieldRef(Database::Customer, Name))

...where SuperFieldRef is some imaginary new type that carries both table and field ID. I'm not sure how we'd then use that though... ;-) just a suggestion, in case others also don't like the repetition, as I don't.
Category: Development
STATUS DETAILS
Needs Votes
Ideas Administrator

Thank you for this suggestion! Currently this is not on our roadmap. We are tracking this idea and if it gathers more votes and comments we will consider it in the future. Best regards, Business Central Team