SetNotifyAppMethod method: ProcessRequest class
Syntax
SetNotifyAppMethod(app_class_name, app_class_method [, JobName] [, PrcsItemLevel] [, JobSeqNo])
Description
Use the SetNotifyAppMethod method to invoke your own custom application class and method to handle process status notification and the information you want to send. This method triggers the delivered PRCS_STATUS_OPER service operation, which invokes the custom method.
Important:
The constructor for the application class cannot require parameters.
Note:
Alternatively, you can create a custom service operation and trigger that service operation using the SetNotifyService method. Your PeopleCode program should call only one of these methods: either SetNotifyAppMethod or SetNotifyService. If both methods are used, the last method called takes precedence over the former.
Parameters
| Parameter | Description |
|---|---|
|
app_class_name |
Specify the fully qualified application class name to be invoked on the target system as a string. |
|
app_class_method |
Specify the name of the method to be invoked on the target system as a string. |
|
JobName |
Specify the name of the job that this item belongs to as a string. |
|
PrcsItemLevel |
Specify the job item's process item level within the main job as a number. |
|
JobSeqNo |
Specify the job item's job sequence number within the process item level as a number. |
Returns
None.
Example
The following example contains two programs. The first program generates the process request setting process status notification through the SetNotifyAppMethod method. The second program defines the application class and method that does additional processing after the status notification has been received by the subscribing system.
Setting process status notification:
/***********************************************************************
* Construct a ProcessRequest Object. *
***********************************************************************/
&RQST = CreateProcessRequest();
&RQST.ProcessType = "Application Engine";
&RQST.Processname = "AEMINITEST";
&RQST.RunControlID = "AEMINI";
&RQST.OutDestType = "WEB";
&RQST.OutDestFormat = "PDF";
&RQST.NotifyTextMsgSet = 65;
&RQST.NotifyTextMsgNum = 237;
&RQST.RunDateTime = %Datetime;
&RQST.TimeZone = %ServerTimeZone;
&RQST.SetNotifyAppMethod("RECEIVE_NOTIFICATION:ProcessNotification", ⇒
"ReceiveNotification");
&RQST.AddNotifyInfo("AEMINITEST Name", "Status");
&RQST.AddNotifyInfo("AEMINITEST Descr", "Status Notify");
&RQST.AddNotifyInfo("AEMINITEST OutType", "EMAIL");
&RQST.Schedule();
&PRCSSTATUS = &RQST.Status;
&PRCSINSTANCE = &RQST.ProcessInstance;
If &PRCSSTATUS = 0 Then
MessageBox(%MsgStyle_OK, "", 65, 366, "Process Instance", ⇒
"AEMINITEST", &PRCSINSTANCE);
Else
MessageBox(%MsgStyle_OK, "", 65, 0, "Process Instance", ⇒
"Process Not submitted");
End-If;
Application class and method definition:
class ProcessNotification
method ProcessNotification();
method ReceiveNotification(&_MSG As Message);
end-class;
/* Class constructor can have no parameters */
method ProcessNotification
end-method;
method ReceiveNotification
/+ &_MSG as Message +/
Local Rowset &rs_msg, &NotifyInfo;
Local Message &message;
Local string &sName, &sValue, &sName2, &sValue2;
&rs_msg = &_MSG.GetRowset();
/*************************************************************/
/* Add logic you want to execute upon receiving notification */
/* For example : */
/* &RQST.SetNotifyAppMethod("RECEIVE_NOTIFICATION: */
/* ProcessNotification", "ReceiveNotification"); */
/* &RQST.AddNotifyInfo("SQR Report", "XRFMENU"); */
If &rs_msg(1).PRCS_STATUS.RUNSTATUS.Value = "9" Then
/* process ran to success */
&NotifyInfo = &rs_msg.GetRow(1).GetRowset(Scroll.PRCSNOTIFYATTR);
/* if you have more name-value pairs */
/* add code to traverse the rows from the PRCSNOTIFYATTR rowset*/
/* e.g. Get the first name-value pair */
&sName = &NotifyInfo(1).PRCSNOTIFYATTR.PRCS_ATTRIBUT_NAME.Value;
&sValue = &NotifyInfo(1).PRCSNOTIFYATTR.PRCS_ATTRIBUT_VALU.Value;
/* e.g. submit a process request */
Local number &PrcsInstance;
Local ProcessRequest &RQST;
&RQST = CreateProcessRequest();
&RQST.ProcessType = &sName;
&RQST.ProcessName = &sValue;
&RQST.RunControlID = "test";
&RQST.RunLocation = "PSNT";
&RQST.OutDestType = "WEB";
&RQST.OutDestFormat = "PDF";
&RQST.RunDateTime = %Datetime;
&RQST.TimeZone = %ServerTimeZone;
&RQST.Schedule();
Else
/* other processing */
End-If;
/*************************************************************/
end-method