ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] codeunit 8612 "Config. Template Management" - multiple publishers

Open alapenas opened this issue 3 years ago • 3 comments

Hello, would it be possible to add OnInsertRecordWithKeyFieldsBeforeValidateFieldValue, OnApplyTemplateLinesWithoutValidationBeforeValidateFieldValue events to codeunit 8612 "Config. Template Management", like this:

    local procedure InsertRecordWithKeyFields(var RecRef: RecordRef; ConfigTemplateHeader: Record "Config. Template Header") 
... 
          for KeyFieldCount := 1 to KeyRef.FieldCount do begin
             FieldRef := KeyRef.FieldIndex(KeyFieldCount);
             ConfigTemplateLine.SetRange("Field ID", FieldRef.Number);
             if ConfigTemplateLine.FindFirst() then begin
>                 OnInsertRecordWithKeyFieldsBeforeValidateFieldValue(ConfigTemplateHeader, ConfigTemplateLine);//New Event
                 ConfigValidateMgt.ValidateFieldValue(
                   RecRef, FieldRef, ConfigTemplateLine."Default Value", false, ConfigTemplateLine."Language ID")
             end else
                 if KeyRef.FieldCount <> 1 then 
    procedure ApplyTemplateLinesWithoutValidation(ConfigTemplateHeader: Record "Config. Template Header"; var RecordRef: RecordRef) 
... 
              repeat
                 if ConfigTemplateLine.Type = ConfigTemplateLine.Type::Field then
                     if RecordRef.FieldExist(ConfigTemplateLine."Field ID") then begin
                         FieldRef := RecordRef.Field(ConfigTemplateLine."Field ID");
>                         OnApplyTemplateLinesWithoutValidationBeforeValidateFieldValue(ConfigTemplateHeader, ConfigTemplateLine);//New Event
                         ConfigValidateMgt.ValidateFieldValue(
                           RecordRef, FieldRef, ConfigTemplateLine."Default Value", true, ConfigTemplateLine."Language ID");
                         RecordRef.Modify(false);
                         OnApplyTemplLinesWithoutValidationAfterRecRefCheck(ConfigTemplateHeader, ConfigTemplateLine, RecordRef); 
  
     [IntegrationEvent(false, false)]
     local procedure OnInsertRecordWithKeyFieldsBeforeValidateFieldValue(var ConfigTemplateHeader: Record "Config. Template Header"; var ConfigTemplateLine: Record "Config. Template Line")
     begin
     end; 
  
     [IntegrationEvent(false, false)]
     local procedure OnApplyTemplateLinesWithoutValidationBeforeValidateFieldValue(var ConfigTemplateHeader: Record "Config. Template Header"; var ConfigTemplateLine: Record "Config. Template Line")
     begin
     end; 

alapenas avatar Feb 27 '23 16:02 alapenas

Please explain the purpose of this events? Which scenario you need to add?

AlexanderYakunin avatar Apr 05 '23 08:04 AlexanderYakunin

Hi @AlexanderYakunin, we would like to alter the value of ConfigTemplateLine."Default Value" depending on additional conditions before passing it to ConfigValidateMgt.ValidateFieldValue().

alapenas avatar Apr 05 '23 09:04 alapenas

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.

Build ID: 11137.

JesperSchulz avatar Jun 15 '23 15:06 JesperSchulz