Event Requests Table 381 - function Test
Please add new 2 events in function Test , table 381
LOCAL [IntegrationEvent] OnBeforeTest(VAR SkipTest : Boolean;VAR Check : Boolean)
LOCAL [IntegrationEvent] GetCheck(VATRegistrationNoFormat : Record "VAT Registration No. Format";VatRegNo : Text[20];CountryCode : Code[10];VAR Check : Boolean)
[External] Test(VATRegNo : Text[20];CountryCode : Code[10];Number : Code[20];TableID : Option) : Boolean VATRegNo := UPPERCASE(VATRegNo); IF VATRegNo = '' THEN EXIT; Check := TRUE; // new + OnBeforeTest(SkipTest,Check); IF SkipTest THEN EXIT(TRUE); // new - IF CountryCode = '' THEN BEGIN IF NOT CompanyInfo.GET THEN EXIT; SETRANGE("Country/Region Code",CompanyInfo."Country/Region Code"); END ELSE SETRANGE("Country/Region Code",CountryCode); SETFILTER(Format,'<> %1',''); IF FINDSET THEN REPEAT AppendString(t,Finish,Format); Check := Compare(VATRegNo,Format); UNTIL Check OR (NEXT = 0); // new code GetCheck(Rec,VatRegNo,CountryCode,Check); IF NOT Check THEN BEGIN IF IdentityManagement.IsInvAppId THEN ERROR(InvalidVatNumberErr); ERROR(STRSUBSTNO('%1%2',STRSUBSTNO(Text000,"Country/Region Code"),STRSUBSTNO(Text001,t))); END;
Hi @JesperSchulz , @jobulsin why did you join 2 events in one? this is not correct and I I disagree with solution. REQUESTED: LOCAL [IntegrationEvent] OnBeforeTest(VAR SkipTest : Boolean;VAR Check : Boolean) LOCAL [IntegrationEvent] GetCheck(VATRegistrationNoFormat : Record "VAT Registration No. Format";VatRegNo : Text[20];CountryCode : Code[10];VAR Check : Boolean)
YOUR SOLUTION: LOCAL [IntegrationEvent] OnBeforeTest(VATRegNo : Text[20];CountryCode : Code[10];Number : Code[20];TableID : Option;Check : Boolean;VAR IsHandled : Boolean) [External] Test(VATRegNo : Text[20];CountryCode : Code[10];Number : Code[20];TableID : Option) : Boolean VATRegNo := UPPERCASE(VATRegNo); IF VATRegNo = '' THEN EXIT; Check := TRUE; IsHandled := FALSE; OnBeforeTest(VATRegNo,CountryCode,Number,TableID,Check,IsHandled); IF IsHandled THEN EXIT(TRUE);
1: In my case I change "Check" and I need Check as reference parameter. 2: I need second event after some code in the same function.
Please check my request again.
I will send your comment to the developer who looked into your case. Generally, we try to limit the amount of events to the minimum possible, but I'm not sure what happened here. I'll have the developer reply to your comment!
You are not a single person asking for events here. You have all flexibility to write you own validation if needed using handled event. If you want to set Check false from beginning, why do you need to run this check as it will not be able to say anything to you?