I have a hidden field “Sstatus” (text, editable) on a document which I need to fill up with the value of the field “status” (dialog list, editable) in the PostOpen event with this instruction:@SetField(“Sstatus”;status);
Later on, I need to check on both fields in the PostSave event to register in an audit trail each time the “Sstatus” differs from “status”.
FIELD status := status;
FIELD Audittrail := Audittrail;
FIELD AuditTextSTAT := AuditTextSTAT;
TodayStr :=@Text(@Day(@Today)) + “-” + @Text(@Month(@Today)) + “-” + @Text(@Year(@Today));
AuditTextSTAT:= AuditTrail + @NewLine + "The field Status has been changed from " + Sstatus + " to " + status + ". " + " on " + TodayStr + " by " + @Name([CN];@UserName) + “.”;
@If(status != Sstatus);
@Do(
@SetField(“AuditTrail”;AuditTextSTAT);
@PostedCommand([ViewRefreshFields])
)
Unfortunately, “Sstatus” remains blank in the PostOpen event and also the “AuditTrail” field in the document is not filled up.