ALAppExtensions
ALAppExtensions copied to clipboard
[Event Request] Codeunit 5051 SegManagement - IsHandled pattern to test the Salesperson code in the TestFields function
Hi,
Is it possible to add the lines that check the value of the Salesperson code in a separate function? Current solution:
local procedure TestFields(var SegmentLine: Record "Segment Line"; Deliver: Boolean)
var
Cont: Record Contact;
Salesperson: Record "Salesperson/Purchaser";
Campaign: Record Campaign;
InteractTmpl: Record "Interaction Template";
ContAltAddr: Record "Contact Alt. Address";
begin
with SegmentLine do begin
TestField(Date);
TestField("Contact No.");
Cont.Get("Contact No.");
if "Document Type" = "Document Type"::" " then begin
TestField("Salesperson Code");
Salesperson.Get("Salesperson Code");
end;
Proposed:
local procedure TestFields(var SegmentLine: Record "Segment Line"; Deliver: Boolean)
var
Cont: Record Contact;
Salesperson: Record "Salesperson/Purchaser";
Campaign: Record Campaign;
InteractTmpl: Record "Interaction Template";
ContAltAddr: Record "Contact Alt. Address";
begin
with SegmentLine do begin
TestField(Date);
TestField("Contact No.");
Cont.Get("Contact No.");
if "Document Type" = "Document Type"::" " then
**TestSalespersonCode(SegmentLine); // call the new function**
local procedure TestSalespersonCode(var SegmentLine: Record "Segment Line")
var
Salesperson: Record "Salesperson/Purchaser";
IsHandled: Boolean;
begin
OnBeforeTestSalespersonCode(SegmentLine, IsHandled);
if IsHandled then
exit;
SegmentLine.TestField("Salesperson Code");
Salesperson.Get(SegmentLine."Salesperson Code");
end;
And add the event OnBeforeTestSalespersonCode(SegmentLine, IsHandled);
[IntegrationEvent(true, false)]
local procedure OnBeforeTestSalespersonCode(var SegmentLine: Record "Segment Line"; var IsHandled: Boolean)
begin
end;
Thank you! Monica Suica
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.