First, create a function inside a derived/work record's FieldFormula.
Function InsertLog(); Local Record &REC1 = CreateRecord(Record.MYRECORDNAME); For &i = 1 To &REC1.FieldCount Local Field &Field = &REC1.GetField(&i); &Field.SetDefault(); End-For; &REC1.AUDIT_OPRID.Value = %OperatorId; &REC1.AUDIT_STAMP.Value = %Datetime; &REC1.MENUNAME.Value = %Menu; &REC1.PNLGRPNAME.Value = %Component; &REC1.PNLNAME.Value = %Page; SQLExec("BEGIN %Insert(:1); END;", &REC1); End-Function;
Next, call the function in your component PostBuild.
Declare Function InsertLog PeopleCode MYDERIVEDRECORD.FIELD1 FieldFormula; InsertUserLog();
What's the trick?
Adding BEGIN and END to your SQLEXEC statement will bypass the validation on PostBuild.
What's the catch?
It will only work on older versions of PeopleTools.
This comment has been removed by the author.
ReplyDelete