The adapter includes the cw_publish_event() function and the cw_publish_future_dated_events()function in the FUNCLIB_CW function library. These functions perform similarly to insert events into the connector's event table. The difference between them is that cw_publish_future_dated_events()enables publishing events with a future effective-date to the event table, and cw_publish_event() does not. If you use events with a future-effective date, use the cw_publish_future_dated_events()function.
This section describes the functions and provides an example of the code that calls them.
The cw_publish_event() function takes four parameters, and the cw_publish_future_dated_events() function takes five parameters:
Using the values specified for its parameters and the information currently available in the Component Buffer, the function gathers the required information from the Component and inserts the event in the event table. The function performs the following:
This section provides examples of the PeopleCode declarations and function calls for each of the two functions. Based on the function you use, insert one of the following code examples into the PeopleCode editor.
Before making the actual function call, use a simple logic test to verify that the Record or Component actually changed. If it did not change, the connector does not call the function, which enhances performance. Also verify that the %userid is not CW. Doing so prevents the connector from interpreting a data change from a request as a new application event.
Code example for cw_publish_event:
/* Place this code in Component's SavePostChg() and define the four */ /* parameters used in the function call */ Declare Function cw_publish_event PeopleCode FUNCLIB_CW.CW_EVENT_NOT FieldFormula; Component String &BONAME1; Component STring &KEYLIST1; Component String &CWPRIORITY1; Component String &CONNID1; &BONAME1 ="Psft_Dept"; &KEYLIST1 = "DEPT_TBL.SetId:DEPT_TBL.DeptId"; &CWPRIORITY = 2; &CONNID1 ="PeopleSoftConnector"; /* Check if Component Changed before calling function */ If ComponentChanged() and %userid <> "CW" then /* Publish this event to the IBM WebSphere CW_EVENT_TBL for polling */ cw_publish_event(&BONAME1,&KEYLIST1,&CWPRIORITY1,&CONNID1); End-if;
Code example for cw_publish_future_dated events:
/* Place this code in Component's SavePostChg() and define the four */ /* parameters used in the function call */ Declare Function cw_publish_future_dated_events PeopleCode FUNCLIB_CW.CW_EVENT_NOT FieldFormula; Component String &BONAME1; Component STring &KEYLIST1; Component String &CWPRIORITY1; Component String &CONNID1; Component String &EFFDATE; &BONAME1 ="psft_CW_TEST_CI"; &KEYLIST1 = "CW_PARENT_TBL.CW_PARENT_KEY1"; &CWPRIORITY = 2; &CONNID1 ="PeopleSoftConnector"; &EFFDATE = CW_PARENT_TBL.CW_PARENT_DTTM"; /* Check if Component Changed before calling function */ If ComponentChanged() and %userid <> "CW" then /* Publish this event to the IBM WebSphere CW_EVENT_TBL for polling */ cw_publish_future_dated_events(&BONAME1,&KEYLIST1,&CWPRIORITY1,&CONNID1, &EFFDATE); End-if;