ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

T39 - OnValidate Description: Add "if GUIALLOWED then"

Open DennisReinecke opened this issue 8 years ago • 4 comments

Please add a if guiallowed then before IF CONFIRM(AnotherItemWithSameDescrQst,FALSE,Item."No.",Item.Description) THEN and IF CONFIRM(AnotherChargeItemWithSameDescQst,FALSE,ItemCharge."No.",ItemCharge.Description) THEN is called.

This is currently causing problems when trying to insert new purchase lines via webservice.

DennisReinecke avatar Jan 08 '18 10:01 DennisReinecke

Thank you for your suggestion. In general, having UI controls such as confirm dialogs in any other place than UI facing objects (such as tables) is an anti-pattern, which you’ll unfortunately find many examples of in our codebase. But I’m afraid I cannot just implement your suggestion, as that would dictate a non-controllable default behavior. Should or shouldn’t VALIDATE("No.",Item."No."); be run, when calling this though a web service? This needs a little more engineering I’m afraid. I’ve added the work to our backlog. Thanks again for your suggestion.

JesperSchulz avatar Jan 11 '18 15:01 JesperSchulz

In understand. I suggested it this way, because it is implemented like this in T37. The web service can't handle searching for similar items at all and I can't think of a valid use case for this. That why it would make sense to limit this functionality to environments with GUI.

DennisReinecke avatar Jan 11 '18 16:01 DennisReinecke

This has been resolved in April 2019 release of Business Central through implementation of Confirm Management Codeunit (Codeunit 27).

ikoletic avatar Jun 13 '19 15:06 ikoletic

IMO, This validation (AnotherItemWithSameDescrQst) makes no sense at all any way.

If I input an Item No, why would the system suggest a different Item? This is just confusing users. It would make more sense if the validation was

if (StrLen(Description) <= MaxStrLen(Item."No.")) and ("Item No." = '') then // so only IF THE ITEM NO. IS EMPTY

Or an option to disable it at least

kvmAlio avatar Jun 19 '24 11:06 kvmAlio