[Event Request] table 5965 "Service Contract Header" procedure OnValidate() field "Status"
Please can you add the following code/event to the above procedure...
trigger OnValidate()
var
ServLedgEntry: Record "Service Ledger Entry";
ConfirmManagement: Codeunit "Confirm Management";
AnyServItemInOtherContract: Boolean;
IsHandled: Boolean; //NEW CODE
begin
if Status <> xRec.Status then begin
CheckChangeStatus();
OnValidateOnAfterCheckChangeStatus(Rec, xRec, IsHandled); //NEW CODE
if IsHandled then //NEW CODE
exit; //NEW CODE
case "Contract Type" of
"Contract Type"::Contract:
begin
OnValidateOnBefore
if Status <> Status::Cancelled then
Error(Text006, FieldCaption(Status));
CalcFields("No. of Unposted Invoices", "No. of Unposted Credit Memos");
The event publisher should be as follows...
[IntegrationEvent(false, false)]
local procedure OnValidateOnAfterCheckChangeStatus(var ServiceContractHeader: Record "Service Contract Header"; xServiceContractHeader: Record "Service Contract Header"; var IsHandled: Boolean);
begin
end;
@JesperSchulz @MarkoTrn Is there any update on this, please? Thank you.
Hi @michaelarmanno-tnp
This request was already resolved. Code from OnValidate is already moved to local procedure ChangeContractStatus(). At the beginning, event OnBeforeChangeContractStatus is raised
Hi @MarkoTrn thanks for your answer. However, I can't see this local proc on table 5965 (BC SaaS 22.1). Am I missing anything?
From BC 22.2 segment of code from line no. 49 has been added to the local procedure ChangeContractStatus
As Event is already implemented by other request(s) we are closing this one.