T39 - OnValidate Description: Add "if GUIALLOWED then"
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.
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.
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.
This has been resolved in April 2019 release of Business Central through implementation of Confirm Management Codeunit (Codeunit 27).
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