Skip to content

KVSKBAVendorTemplMgt#

Events#

OnBeforeFindVendorTempl(Record Contact, Code[20], Boolean) :#

Summary: Integration event that fires before vendor template search logic is executed.

[IntegrationEvent(false, false)]
local procedure OnBeforeFindVendorTempl(Contact: Record "Contact"; var TemplateCode: Code[20]; var IsHandled: Boolean): 
[EventSubscriber(ObjectType::Codeunit, Codeunit::"KVSKBAVendorTemplMgt", 'OnBeforeFindVendorTempl', '', false, false)]
local procedure DoSomethingOnBeforeFindVendorTempl(Contact: Record "Contact"; var TemplateCode: Code[20]; var IsHandled: Boolean)
begin
end;

Parameters:

  • Contact: The contact record for which a vendor template is being searched.
  • TemplateCode: Variable parameter to return the template code if custom logic is used.
  • IsHandled: Variable parameter to indicate if the event subscriber handled the template search.

Remarks: This integration event allows extensions to override the standard vendor template search logic in the FindVendorTempl procedure. If an event subscriber sets IsHandled to true and provides a TemplateCode, the standard filtering logic will be bypassed.

         **Event Characteristics:**
         - IncludeSender: false (sender parameter not included)
         - EventPublisherElement: false (not specific to table field)

         **Event Subscriber Pattern:**
         1. Implement custom template selection logic
         2. Set TemplateCode to the selected template code
         3. Set IsHandled := true to prevent standard logic
         4. Leave IsHandled as false to allow standard logic to proceed

         **Use Cases:**
         - Custom template selection algorithms based on additional criteria
         - External system integration for template determination
         - Industry-specific vendor template selection rules
         - Multi-tenant template assignment logic
         - Advanced filtering beyond territory, country, and currency

         **Parameters:**
         - Contact: Provides full access to contact data for decision logic
         - TemplateCode: Must be set to a valid Vendor Template code
         - IsHandled: Controls whether standard logic is bypassed