Using WITH statements in combination with function parameters can often lead to errors, since the WITH statement is using the record 'field' instead of the - by the developer intended - function parameter.

In the function below, it would be interesting to have a CodeCop rule to alert to refactor the code by either removing the WITH statement, either by renaming the function parameter 'Code' to 'NewCode' or 'PaymentTermsCode' to improve readibility / avoid future conflicts.

CreatePaymentsTerms(Code : Code[10])
WITH PaymentTerms DO BEGIN
Code := Code;
Category: Development
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