I am currently writing a workflow module. In the first response, I save data to a table called notifyEntry. In another response, I would like the record to be deleted.
local procedure CreateNotifyEntry(var Variant: Variant; WorkflowStepInstance: Record "Workflow Step Instance")
var
RecRef: RecordRef;
NotifyEntry: Record "Notify Entry";
begin
RecRef.GetTable(Variant);
PopulateNotifyEntryArgument(RecRef, WorkflowStepInstance, NotifyEntry);
NotifyEntry.Insert(true);
end;
local procedure PopulateNotifyEntryArgument(RecRef: RecordRef; WorkflowStepInstance: Record "Workflow Step Instance"; var NotifyEntry: Record "Notify Entry")
var
Header: Record "Management Header";
Handled: Boolean;
begin
NotifyEntry.Init();
NotifyEntry."Table ID" := RecRef.Number;
NotifyEntry."Source Record ID" := RecRef.RecordId;
NotifyEntry."Workflow Step Instance ID" := WorkflowStepInstance.ID;
case RecRef.Number of
Database::"Header Management":
begin
NotifyEntry."Contact No." := Header.NotifyContactNo;
NotifyEntry."Expiration Date/Time" := CreateDateTime(Header."Task Date", 0T);
end;
else begin
Handled := false;
OnPopulateNotifyEntryArgument(Handled, RecRef, NotifyEntry);
if not Handled then
error(NotSupportedSourceForNotifyEntryErr, RecRef.Caption);
end;
end;
end;
As can be seen in the source code, I save data from Management Header in NotifyEntry in the first response. The source record ID is also saved in the table. However, I am not sure how I can delete exactly this entry in the Delete Response. Can someone help me to solve this problem?