Creating Workflow PeopleCode Programs
Do not use this section for components with Virtual Approver.
The general structure of all Workflow PeopleCode programs is the same:
-
Check for the condition under which a business event should be triggered.
This condition is a business rule.
-
If the condition is true, trigger the event.
The system automatically determines whether the event is active and, if so, triggers it. If you have deactivated the event, the system does not run it.
A typical Workflow PeopleCode program looks like this:
/* Start the Employee Training process for a new course request */
if RecordNew(ATTENDANCE) then
if COURSE_TBL.INTERNAL_EXTERNAL = "I" then
/* For internal courses */
&TEMP = TriggerBusinessEvent(BUSPROCESS."Employee Training",BUSACTIVITY."Request Course",
BUSACTIVITY."Request Course",BUSEVENT."Internal Course Request");
else
/* For external courses */
&TEMP = TriggerBusinessEvent(BUSPROCESS."Employee Training",BUSACTIVITY."Request Course",
BUSEVENT."External Course Request");
end-if;