ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Table 5050 Contact add event "OnBeforeCreateLink"

Open samra-singhammer opened this issue 4 years ago • 1 comments

Additional Event needed:

OnBeforeCreateLink(Rec: Contact; var IsHandled: boolean);

procedure CreateCustomerLink()
var
    Cust: Record Customer;
    ContBusRel: Record "Contact Business Relation";
begin
    CheckForExistingRelationships(ContBusRel."Link to Table"::Customer);
    CheckIfPrivacyBlockedGeneric;
    RMSetup.Get();
    RMSetup.TestField("Bus. Rel. Code for Customers");

    **OnBeforeCreateLink(Rec: Contact; var IsHandled: boolean);**
    **if IsHandled then**
        **exit;**

    CreateLink(
      PAGE::"Customer Link",
      RMSetup."Bus. Rel. Code for Customers",
      ContBusRel."Link to Table"::Customer);

    ContBusRel.SetCurrentKey("Link to Table", "Contact No.");
    ContBusRel.SetRange("Link to Table", ContBusRel."Link to Table"::Customer);
    ContBusRel.SetRange("Contact No.", "Company No.");
    if ContBusRel.FindFirst then
        if Cust.Get(ContBusRel."No.") then
            #if not CLEAN18
            UpdateQuotes(Cust, '');
            #else
            UpdateQuotesFromTemplate(Cust, '');
            #endif
    OnAfterCreateCustomerLink(Rec);
    end;

samra-singhammer avatar Dec 06 '21 08:12 samra-singhammer

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

JesperSchulz avatar Dec 30 '21 13:12 JesperSchulz