HOW-TO: Code to Mark a Completed Worklist Entry

HOW-TO: Code to Mark a Completed Worklist Entry

Anoop Savio over at the Oracle PeopleSoft Blog has a very useful code snippet to mark a Worklist Entry complete. It’s detailed below, and we think it’s something our customers might like to see. Thanks, Anoop!

Below is an example code is to mark the Worklist Entry as 
completed once the corresponding request is approved.
import PT_WF_WORKLIST:*;
Local WorklistEntry &worklist;

&worklist = create WorklistEntry();
&worklist.busprocname = "Administer Workflow";
&worklist.busactivity = "Send Note";
&worklist.buseventname = "Worklist Note";
&worklist.worklistname = "Worklist Note";
&worklist.instanceid = 2;

&ret = &worklist.SelectByKey();
&worklist.inststatus = "2"; /* mark entry worked */
If (&worklist.Update() <> 0) Then
   If (&worklist.Save() <> 0) Then
      /* success */
   Else
      /* handle error */
   End-If;
Else
   /* handle error */
End-If;

The other values for inststatus are given below. 
This property is read-write:

0: New worklist entry
1: Selected worklist entry
2: Worked worklist entry
3: Cancel string
+ posts