-
Notifications
You must be signed in to change notification settings - Fork 692
Description
Why do you need this change?
Problem statement:
We are using something as branches in Contacts it means that we can have more contacts with same Taxt ID or Registrations. These contacts use custom pole with "Supervisor Unit" and we have to check contacts over this new field. So we have to skip standard check, because it can't works with supervisor contact and It doesn't allow same IDs
Alternatives evaluated:
- There is now events for this and we have to substitute standard code with our advance code.
Subscriber example (illustrative):
ParentContact.Get(Number);
while ParentContact."Superior Organization Unit" <> '' do
ParentContact.Get(ParentContact."Superior Organization Unit");
TempContact.Init;
TempContact := ParentContact;
TempContact.Insert;
ParentContact.AddAssociatedContactsToBuffer(ParentContact, TempContact);
if Cont.FindSet then
repeat
if not TempContact.Get(Cont."No.") then begin
Finish := not AddToNumberList(Cont."No.");
Found := true;
end;
until (Cont.Next = 0) or Finish;Performance & data considerations:
There are not sensitive data expose outside
MultiÔÇæextension interaction:
Procedure doesn't call some events it means that we do not change behavior for other extensions, but we keep our logic for them if they will call same function
Justification for using IsHandled over alternatives:
Standard process raises error that block process. Errors have to be skipped because we use advance check for supervisored contacts.
Describe the request
local procedure CheckContactDuplicity(RegNo: Text[20]; Number: Code[20]; IsTax: Boolean)
var
//---------------------------------------OnBeforeCheckContactDuplicity:BEGIN
IsHandled: Boolean;
//---------------------------------------OnBeforeCheckContactDuplicity:END
begin
//---------------------------------------OnBeforeCheckContactDuplicity:BEGIN
IsHandled := false;
OnBeforeCheckContactDuplicity(Contact, RegNo, Number, NumberList, IsTax, StopCheck IsHandled);
if IsHandled then
exit;
//---------------------------------------OnBeforeCheckContactDuplicity:END
if not IsTax then
Contact.SetRange("Registration Number", RegNo)
else
Contact.SetRange("Tax Registration No. CZL", RegNo);
Contact.SetFilter("No.", '<>%1', Number);
if Contact.FindSet() then
repeat
StopCheck := AddToNumberList(Contact."No.");
until (Contact.Next() = 0) or StopCheck;
if Contact.Count > 0 then
Message(RegNoEnteredContMsg, GetFieldCaption(IsTax), NumberList);
end;
//---------------------------------------OnBeforeCheckContactDuplicity:BEGIN
[IntegrationEvent(false, false)]
local procedure OnBeforeCheckContactDuplicity(var Contact: Record Contact; RegNo: Text[20]; Number: Code[20]; var NumberList: Text[250]; IsTax: Boolean; var StopCheck: Boolean; var IsHandled: Boolean)
begin
end;
//---------------------------------------OnBeforeCheckContactDuplicity:ENDInternal work item: AB#626274