Find SendMail Peoplecode












0














We have custom functionality in PeopleSoft FSCM that generates an email notification with a link to direct users to approve vouchers online. I have found part of the text string variable that compose the email message within the following Record PeopleCode, however I can not seem to find where the actual outbound email object is created and Send method is being called and using the &EMAIL_TEXT variable. I've done Find In searches for the variable but that has not led me to the code that generates the emails. Any suggestions for how to find it is appreciated!



Here is the code snippet with the email body variable:



&EMAIL_TEXT = "Please review and take approval action for the following:" | Char(10) | "Business Unit: " | VCHR_APPRVL.BUSINESS_UNIT.Value | Char(10) | "Voucher ID: " | VCHR_APPRVL.VOUCHER_ID | Char(10) | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "The following hyperlink will take you to the voucher approval page:" | Char(10);
&URL = GenerateComponentPortalURL("EMPLOYEE", Node.ERP, MenuName.ENTER_VOUCHER_INFORMATION, "GBL", Component.VCHR_APPROVE, Page.VCHR_APPRVL_WF, "U", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID);
&EMAIL_TEXT = &EMAIL_TEXT | &URL | Char(10);

&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "Questions pertaining to this data should be directed to AccountsPayable_GH@guthrie.org" | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "****DO NOT REPLY TO THIS EMAIL AS THIS ACCOUNT IS NOT MONITORED****" | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
GH_VCHR_APR_WRK.EMAILTEXT.Value = &EMAIL_TEXT;


Here is the entire Record PeopleCode (for context) on the field BUSPROCNAME with the SaveEdit action:



Declare Function virtual_approver PeopleCode APPR_VA0_WRK.FUNCLIB_01 FieldFormula;
Declare Function get_roleuser PeopleCode APPR_VA0_WRK.ROLEUSER FieldChange;
Declare Function get_message_text PeopleCode WF_FUNCLIB_WRK.FUNCLIB_01 FieldFormula;

Component boolean &overrideapprover;

Function get_denial_role();
&SETID = GetSetId(Field.BUSINESS_UNIT, VCHR_APPRVL.BUSINESS_UNIT, Record.BUS_UNIT_OPT_AP, "");
&CURRDATE = %Date;
SQLExec("Select a.rolename from ps_bus_unit_opt_ap a where a.setid = :1 and a.effdt = (Select max(b.effdt) from ps_bus_unit_opt_ap b where b.setid = :2 and b.effdt <= %datein(:3) and b.eff_status = 'A')", &SETID, &SETID, &CURRDATE, APPR_FIELDS_WRK.ROLENAME);
End-Function;

Function get_deptid(&BU, &Voucher_ID, &Dept_Cnt, &DEPTID);
Local SQL &SQL_DEPTID;
&Dept_Cnt = 0;
/* If &VOUCHER_STYLE = "JRNL" Or
&VOUCHER_STYLE = "CORR" Or
&VOUCHER_STYLE = "ADJ" Then
MessageBox(0, "", 0, 0, "Jrnl or Adj or Reversal. So assigning 99999", 0);
&DEPTID = "99999";
&Dept_Cnt = 1;
Else */
SQLExec("SELECT DEPTID FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", &BU, &Voucher_ID, &DEPTID);
If All(&DEPTID) Then
&Dept_Cnt = 1;
Else
&SQL_DEPTID = CreateSQL("SELECT DISTINCT DEPTID FROM PS_DISTRIB_LINE A, PS_PO_LINE B WHERE A.BUSINESS_UNIT = :1 AND VOUCHER_ID = :2 AND A.BUSINESS_UNIT_PO = B.BUSINESS_UNIT AND A.PO_ID = B.PO_ID AND A.LINE_NBR = B.LINE_NBR AND B.RECV_REQ <> 'Y'", &BU, &Voucher_ID);
While &SQL_DEPTID.Fetch(&DEPTID_Fetch)
&Dept_Cnt = &Dept_Cnt + 1;
&DEPTID = &DEPTID_Fetch;
End-While;
End-If;
rem End-If;
End-Function;


/* ---------------- beginning of mainline --------------------------*/
/* ICE 597971000 - TMG - 06/17/03 */
/* Check if nothing has changed on the approval status */
If Not FieldChanged(VCHR_APPRVL.APPR_STATUS) Then
Error MsgGet(7045, 5, "The approval status has not been changed/updated, page cannot be saved until the approval status has been modified.!");
End-If;

If VCHR_APPRVL.APPR_STATUS = "D" And
VCHR_FS.APPR_INSTANCE = 0 Then
Error MsgGet(7045, 7, "The voucher cannot be Denied until it has been routed.");
End-If;


/* ICE 531713000 - TMG - 12/13/02 */
/* Check if voucher status has changed */

rem SQLExec("SELECT ENTRY_STATUS, CLOSE_STATUS, PROCESS_MAN_CLOSE FROM PS_VOUCHER WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &ENTRY_STATUS, &CLOSE_STATUS, &PROCESS_MAN_CLOSE);
SQLExec("SELECT ENTRY_STATUS, CLOSE_STATUS, PROCESS_MAN_CLOSE, VOUCHER_STYLE FROM PS_VOUCHER WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &ENTRY_STATUS, &CLOSE_STATUS, &PROCESS_MAN_CLOSE, &VOUCHER_STYLE);

If &ENTRY_STATUS = "P" And
&CLOSE_STATUS <> "C" And
&PROCESS_MAN_CLOSE <> "Y" Then

/* Check if worklist item has been cancelled */
&INSTANCEID = %WLInstanceId;
If All(&INSTANCEID) Then
SQLExec("SELECT MAX(A.ACTIVITYNAME), MAX(A.EVENTNAME), MAX(A.WORKLISTNAME) FROM PS_VCHR_WL1 A, PSWORKLIST B WHERE A.BUSPROCNAME = B.BUSPROCNAME AND A.ACTIVITYNAME = B.ACTIVITYNAME AND A.EVENTNAME = B.EVENTNAME AND A.WORKLISTNAME = B.WORKLISTNAME AND A.INSTANCEID = B.INSTANCEID AND A.BUSPROCNAME = :1 AND A.BUSINESS_UNIT = :2 AND A.VOUCHER_ID = :3 AND A.INSTANCEID = :4", VCHR_APPRVL.BUSPROCNAME, VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &INSTANCEID, &ACTIVITYNAME, &EVENTNAME, &WORKLISTNAME);

SQLExec("SELECT INSTSTATUS FROM PSWORKLIST WHERE BUSPROCNAME = :1 AND ACTIVITYNAME = :2 AND EVENTNAME = :3 AND WORKLISTNAME = :4 AND INSTANCEID = :5", VCHR_APPRVL.BUSPROCNAME, &ACTIVITYNAME, &EVENTNAME, &WORKLISTNAME, &INSTANCEID, &INSTSTATUS);

If &INSTSTATUS = 3 Then
Error MsgGet(7045, 4, "Voucher approval status cannot be changed because worklist item has been cancelled.")
End-If;
End-If;
Else
Error MsgGet(7045, 3, "Voucher approval status cannot be changed because voucher status has changed.");
End-If;

/* If (APPR_STATUS = "A" And
%MessageAgent = "") Or
(APPR_STATUS = "P" And
%MessageAgent <> "") Then */
If VCHR_APPRVL.APPR_STATUS = "A" And
%CompIntfcName <> "" Or
VCHR_APPRVL.APPR_STATUS = "D" Then
If &overrideapprover = True Then
rem &OPRID = ""; /*custom commented this line and added the next*/
&OPRID = VCHR_FS.OPRID;
Else
&OPRID = %OperatorId;
End-If;
get_roleuser(&OPRID, &EMAILID, &FORMID, &EMPLID, &ROLEUSER);
rem the following four fields are required;
APPR_FIELDS_WRK.BUSPROCNAME = VCHR_APPRVL.BUSPROCNAME;
APPR_FIELDS_WRK.APPR_RULE_SET = VCHR_APPRVL.APPR_RULE_SET;
APPR_FIELDS_WRK.ROLEUSER = &ROLEUSER;
APPR_FIELDS_WRK.APPR_INSTANCE = VCHR_APPRVL.APPR_INSTANCE;
SQLExec("SELECT GH_BUSINESS_UNIT_O FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", &BU, &Voucher_ID, &GH_BUSINESS_UNIT_O); */
SQLExec("SELECT GH_BUSINESS_UNIT_O FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &GH_BUSINESS_UNIT_O);
VCHR_APPRVL_WRK.GH_BUSINESS_UNIT_O.Value = &GH_BUSINESS_UNIT_O;
get_deptid(VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &Dept_Cnt, &DEPTID);

&EMAIL_TEXT = "Please review and take approval action for the following:" | Char(10) | "Business Unit: " | VCHR_APPRVL.BUSINESS_UNIT.Value | Char(10) | "Voucher ID: " | VCHR_APPRVL.VOUCHER_ID | Char(10) | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "The following hyperlink will take you to the voucher approval page:" | Char(10);
&URL = GenerateComponentPortalURL("EMPLOYEE", Node.ERP, MenuName.ENTER_VOUCHER_INFORMATION, "GBL", Component.VCHR_APPROVE, Page.VCHR_APPRVL_WF, "U", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID);
&EMAIL_TEXT = &EMAIL_TEXT | &URL | Char(10);

&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "Questions pertaining to this data should be directed to AccountsPayable_GH@guthrie.org" | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | "****DO NOT REPLY TO THIS EMAIL AS THIS ACCOUNT IS NOT MONITORED****" | Char(10);
&EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
GH_VCHR_APR_WRK.EMAILTEXT.Value = &EMAIL_TEXT;

If None(&DEPTID) Then
REM VCHR_APPRVL_WRK.DEPTID.Value = "99999";
MessageBox(0, "", 0, 0, "No Deptid. So assigning 99999", 0);
VCHR_APPRVL_WRK.DEPTID.Value = "99999";
Else
VCHR_APPRVL_WRK.DEPTID.Value = &DEPTID;
End-If;
If VCHR_APPRVL.APPR_STATUS = "D" Then
APPR_FIELDS_WRK.APPR_ACTION = "D";
Else
APPR_FIELDS_WRK.APPR_ACTION = "A";
End-If;
If VCHR_APPRVL.APPR_STATUS = "A" Then
VCHR_APPRVL.APPR_STATUS = "P";
End-If;
virtual_approver();
If &overrideapprover = True Then
&overrideapprover = False;
End-If;
VCHR_APPRVL.APPR_CHECK_FLG = "Y";
rem;
VCHR_APPRVL.APPR_STATUS = APPR_FIELDS_WRK.APPR_STATUS;
remark set up the message for e-mail if denied;
If VCHR_APPRVL.APPR_STATUS = "D" Then
&LANGUAGE_CD = PSOPTIONS.LANGUAGE_CD;
&MESSAGE_SET_NBR = 7045;
&MESSAGE_NBR = 2;
&BIND1 = VCHR_FS.BUSINESS_UNIT | "/" | VCHR_FS.VOUCHER_ID;
&BIND2 = APPR_FIELDS_WRK.ROLEUSER;
&BIND3 = VCHR_FS.VENDOR_ID | ", " | VENDOR.NAME1;
&BIND4 = VCHR_FS.INVOICE_ID | " (" | VCHR_FS.INVOICE_DT | ")";
&BIND5 = VCHR_FS.GROSS_AMT | "(" | VCHR_FS.TXN_CURRENCY_CD | ")";
get_message_text(&MESSAGE_SET_NBR, &MESSAGE_NBR, &BIND1, &BIND2, &BIND3, &BIND4, &BIND5, &MESSAGE_TEXT, &DESCRLONG);
UpdateValue(VCHR_APPRVL_MSG.EMAIL_SUBJECT_LONG, 1, &DESCRLONG);
UpdateValue(VCHR_APPRVL_MSG.EMAIL_TEXTLONG, 1, &MESSAGE_TEXT);
remark get the role to send denials to;
get_denial_role();
VCHR_APPRVL_WRK.RTE_CNTL_TYPE1 = "Business Unit";
VCHR_APPRVL_WRK.RTE_CNTL_TYPE2 = "Administrative Area";
VCHR_APPRVL_WRK.WF_ADMIN_AREA = "AP";
VCHR_APPRVL_WRK.ROLENAME = APPR_FIELDS_WRK.ROLENAME;
End-If;
End-If;









share|improve this question



























    0














    We have custom functionality in PeopleSoft FSCM that generates an email notification with a link to direct users to approve vouchers online. I have found part of the text string variable that compose the email message within the following Record PeopleCode, however I can not seem to find where the actual outbound email object is created and Send method is being called and using the &EMAIL_TEXT variable. I've done Find In searches for the variable but that has not led me to the code that generates the emails. Any suggestions for how to find it is appreciated!



    Here is the code snippet with the email body variable:



    &EMAIL_TEXT = "Please review and take approval action for the following:" | Char(10) | "Business Unit: " | VCHR_APPRVL.BUSINESS_UNIT.Value | Char(10) | "Voucher ID: " | VCHR_APPRVL.VOUCHER_ID | Char(10) | Char(10) | Char(10);
    &EMAIL_TEXT = &EMAIL_TEXT | "The following hyperlink will take you to the voucher approval page:" | Char(10);
    &URL = GenerateComponentPortalURL("EMPLOYEE", Node.ERP, MenuName.ENTER_VOUCHER_INFORMATION, "GBL", Component.VCHR_APPROVE, Page.VCHR_APPRVL_WF, "U", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID);
    &EMAIL_TEXT = &EMAIL_TEXT | &URL | Char(10);

    &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
    &EMAIL_TEXT = &EMAIL_TEXT | "Questions pertaining to this data should be directed to AccountsPayable_GH@guthrie.org" | Char(10);
    &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
    &EMAIL_TEXT = &EMAIL_TEXT | "****DO NOT REPLY TO THIS EMAIL AS THIS ACCOUNT IS NOT MONITORED****" | Char(10);
    &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
    GH_VCHR_APR_WRK.EMAILTEXT.Value = &EMAIL_TEXT;


    Here is the entire Record PeopleCode (for context) on the field BUSPROCNAME with the SaveEdit action:



    Declare Function virtual_approver PeopleCode APPR_VA0_WRK.FUNCLIB_01 FieldFormula;
    Declare Function get_roleuser PeopleCode APPR_VA0_WRK.ROLEUSER FieldChange;
    Declare Function get_message_text PeopleCode WF_FUNCLIB_WRK.FUNCLIB_01 FieldFormula;

    Component boolean &overrideapprover;

    Function get_denial_role();
    &SETID = GetSetId(Field.BUSINESS_UNIT, VCHR_APPRVL.BUSINESS_UNIT, Record.BUS_UNIT_OPT_AP, "");
    &CURRDATE = %Date;
    SQLExec("Select a.rolename from ps_bus_unit_opt_ap a where a.setid = :1 and a.effdt = (Select max(b.effdt) from ps_bus_unit_opt_ap b where b.setid = :2 and b.effdt <= %datein(:3) and b.eff_status = 'A')", &SETID, &SETID, &CURRDATE, APPR_FIELDS_WRK.ROLENAME);
    End-Function;

    Function get_deptid(&BU, &Voucher_ID, &Dept_Cnt, &DEPTID);
    Local SQL &SQL_DEPTID;
    &Dept_Cnt = 0;
    /* If &VOUCHER_STYLE = "JRNL" Or
    &VOUCHER_STYLE = "CORR" Or
    &VOUCHER_STYLE = "ADJ" Then
    MessageBox(0, "", 0, 0, "Jrnl or Adj or Reversal. So assigning 99999", 0);
    &DEPTID = "99999";
    &Dept_Cnt = 1;
    Else */
    SQLExec("SELECT DEPTID FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", &BU, &Voucher_ID, &DEPTID);
    If All(&DEPTID) Then
    &Dept_Cnt = 1;
    Else
    &SQL_DEPTID = CreateSQL("SELECT DISTINCT DEPTID FROM PS_DISTRIB_LINE A, PS_PO_LINE B WHERE A.BUSINESS_UNIT = :1 AND VOUCHER_ID = :2 AND A.BUSINESS_UNIT_PO = B.BUSINESS_UNIT AND A.PO_ID = B.PO_ID AND A.LINE_NBR = B.LINE_NBR AND B.RECV_REQ <> 'Y'", &BU, &Voucher_ID);
    While &SQL_DEPTID.Fetch(&DEPTID_Fetch)
    &Dept_Cnt = &Dept_Cnt + 1;
    &DEPTID = &DEPTID_Fetch;
    End-While;
    End-If;
    rem End-If;
    End-Function;


    /* ---------------- beginning of mainline --------------------------*/
    /* ICE 597971000 - TMG - 06/17/03 */
    /* Check if nothing has changed on the approval status */
    If Not FieldChanged(VCHR_APPRVL.APPR_STATUS) Then
    Error MsgGet(7045, 5, "The approval status has not been changed/updated, page cannot be saved until the approval status has been modified.!");
    End-If;

    If VCHR_APPRVL.APPR_STATUS = "D" And
    VCHR_FS.APPR_INSTANCE = 0 Then
    Error MsgGet(7045, 7, "The voucher cannot be Denied until it has been routed.");
    End-If;


    /* ICE 531713000 - TMG - 12/13/02 */
    /* Check if voucher status has changed */

    rem SQLExec("SELECT ENTRY_STATUS, CLOSE_STATUS, PROCESS_MAN_CLOSE FROM PS_VOUCHER WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &ENTRY_STATUS, &CLOSE_STATUS, &PROCESS_MAN_CLOSE);
    SQLExec("SELECT ENTRY_STATUS, CLOSE_STATUS, PROCESS_MAN_CLOSE, VOUCHER_STYLE FROM PS_VOUCHER WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &ENTRY_STATUS, &CLOSE_STATUS, &PROCESS_MAN_CLOSE, &VOUCHER_STYLE);

    If &ENTRY_STATUS = "P" And
    &CLOSE_STATUS <> "C" And
    &PROCESS_MAN_CLOSE <> "Y" Then

    /* Check if worklist item has been cancelled */
    &INSTANCEID = %WLInstanceId;
    If All(&INSTANCEID) Then
    SQLExec("SELECT MAX(A.ACTIVITYNAME), MAX(A.EVENTNAME), MAX(A.WORKLISTNAME) FROM PS_VCHR_WL1 A, PSWORKLIST B WHERE A.BUSPROCNAME = B.BUSPROCNAME AND A.ACTIVITYNAME = B.ACTIVITYNAME AND A.EVENTNAME = B.EVENTNAME AND A.WORKLISTNAME = B.WORKLISTNAME AND A.INSTANCEID = B.INSTANCEID AND A.BUSPROCNAME = :1 AND A.BUSINESS_UNIT = :2 AND A.VOUCHER_ID = :3 AND A.INSTANCEID = :4", VCHR_APPRVL.BUSPROCNAME, VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &INSTANCEID, &ACTIVITYNAME, &EVENTNAME, &WORKLISTNAME);

    SQLExec("SELECT INSTSTATUS FROM PSWORKLIST WHERE BUSPROCNAME = :1 AND ACTIVITYNAME = :2 AND EVENTNAME = :3 AND WORKLISTNAME = :4 AND INSTANCEID = :5", VCHR_APPRVL.BUSPROCNAME, &ACTIVITYNAME, &EVENTNAME, &WORKLISTNAME, &INSTANCEID, &INSTSTATUS);

    If &INSTSTATUS = 3 Then
    Error MsgGet(7045, 4, "Voucher approval status cannot be changed because worklist item has been cancelled.")
    End-If;
    End-If;
    Else
    Error MsgGet(7045, 3, "Voucher approval status cannot be changed because voucher status has changed.");
    End-If;

    /* If (APPR_STATUS = "A" And
    %MessageAgent = "") Or
    (APPR_STATUS = "P" And
    %MessageAgent <> "") Then */
    If VCHR_APPRVL.APPR_STATUS = "A" And
    %CompIntfcName <> "" Or
    VCHR_APPRVL.APPR_STATUS = "D" Then
    If &overrideapprover = True Then
    rem &OPRID = ""; /*custom commented this line and added the next*/
    &OPRID = VCHR_FS.OPRID;
    Else
    &OPRID = %OperatorId;
    End-If;
    get_roleuser(&OPRID, &EMAILID, &FORMID, &EMPLID, &ROLEUSER);
    rem the following four fields are required;
    APPR_FIELDS_WRK.BUSPROCNAME = VCHR_APPRVL.BUSPROCNAME;
    APPR_FIELDS_WRK.APPR_RULE_SET = VCHR_APPRVL.APPR_RULE_SET;
    APPR_FIELDS_WRK.ROLEUSER = &ROLEUSER;
    APPR_FIELDS_WRK.APPR_INSTANCE = VCHR_APPRVL.APPR_INSTANCE;
    SQLExec("SELECT GH_BUSINESS_UNIT_O FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", &BU, &Voucher_ID, &GH_BUSINESS_UNIT_O); */
    SQLExec("SELECT GH_BUSINESS_UNIT_O FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &GH_BUSINESS_UNIT_O);
    VCHR_APPRVL_WRK.GH_BUSINESS_UNIT_O.Value = &GH_BUSINESS_UNIT_O;
    get_deptid(VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &Dept_Cnt, &DEPTID);

    &EMAIL_TEXT = "Please review and take approval action for the following:" | Char(10) | "Business Unit: " | VCHR_APPRVL.BUSINESS_UNIT.Value | Char(10) | "Voucher ID: " | VCHR_APPRVL.VOUCHER_ID | Char(10) | Char(10) | Char(10);
    &EMAIL_TEXT = &EMAIL_TEXT | "The following hyperlink will take you to the voucher approval page:" | Char(10);
    &URL = GenerateComponentPortalURL("EMPLOYEE", Node.ERP, MenuName.ENTER_VOUCHER_INFORMATION, "GBL", Component.VCHR_APPROVE, Page.VCHR_APPRVL_WF, "U", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID);
    &EMAIL_TEXT = &EMAIL_TEXT | &URL | Char(10);

    &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
    &EMAIL_TEXT = &EMAIL_TEXT | "Questions pertaining to this data should be directed to AccountsPayable_GH@guthrie.org" | Char(10);
    &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
    &EMAIL_TEXT = &EMAIL_TEXT | "****DO NOT REPLY TO THIS EMAIL AS THIS ACCOUNT IS NOT MONITORED****" | Char(10);
    &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
    GH_VCHR_APR_WRK.EMAILTEXT.Value = &EMAIL_TEXT;

    If None(&DEPTID) Then
    REM VCHR_APPRVL_WRK.DEPTID.Value = "99999";
    MessageBox(0, "", 0, 0, "No Deptid. So assigning 99999", 0);
    VCHR_APPRVL_WRK.DEPTID.Value = "99999";
    Else
    VCHR_APPRVL_WRK.DEPTID.Value = &DEPTID;
    End-If;
    If VCHR_APPRVL.APPR_STATUS = "D" Then
    APPR_FIELDS_WRK.APPR_ACTION = "D";
    Else
    APPR_FIELDS_WRK.APPR_ACTION = "A";
    End-If;
    If VCHR_APPRVL.APPR_STATUS = "A" Then
    VCHR_APPRVL.APPR_STATUS = "P";
    End-If;
    virtual_approver();
    If &overrideapprover = True Then
    &overrideapprover = False;
    End-If;
    VCHR_APPRVL.APPR_CHECK_FLG = "Y";
    rem;
    VCHR_APPRVL.APPR_STATUS = APPR_FIELDS_WRK.APPR_STATUS;
    remark set up the message for e-mail if denied;
    If VCHR_APPRVL.APPR_STATUS = "D" Then
    &LANGUAGE_CD = PSOPTIONS.LANGUAGE_CD;
    &MESSAGE_SET_NBR = 7045;
    &MESSAGE_NBR = 2;
    &BIND1 = VCHR_FS.BUSINESS_UNIT | "/" | VCHR_FS.VOUCHER_ID;
    &BIND2 = APPR_FIELDS_WRK.ROLEUSER;
    &BIND3 = VCHR_FS.VENDOR_ID | ", " | VENDOR.NAME1;
    &BIND4 = VCHR_FS.INVOICE_ID | " (" | VCHR_FS.INVOICE_DT | ")";
    &BIND5 = VCHR_FS.GROSS_AMT | "(" | VCHR_FS.TXN_CURRENCY_CD | ")";
    get_message_text(&MESSAGE_SET_NBR, &MESSAGE_NBR, &BIND1, &BIND2, &BIND3, &BIND4, &BIND5, &MESSAGE_TEXT, &DESCRLONG);
    UpdateValue(VCHR_APPRVL_MSG.EMAIL_SUBJECT_LONG, 1, &DESCRLONG);
    UpdateValue(VCHR_APPRVL_MSG.EMAIL_TEXTLONG, 1, &MESSAGE_TEXT);
    remark get the role to send denials to;
    get_denial_role();
    VCHR_APPRVL_WRK.RTE_CNTL_TYPE1 = "Business Unit";
    VCHR_APPRVL_WRK.RTE_CNTL_TYPE2 = "Administrative Area";
    VCHR_APPRVL_WRK.WF_ADMIN_AREA = "AP";
    VCHR_APPRVL_WRK.ROLENAME = APPR_FIELDS_WRK.ROLENAME;
    End-If;
    End-If;









    share|improve this question

























      0












      0








      0







      We have custom functionality in PeopleSoft FSCM that generates an email notification with a link to direct users to approve vouchers online. I have found part of the text string variable that compose the email message within the following Record PeopleCode, however I can not seem to find where the actual outbound email object is created and Send method is being called and using the &EMAIL_TEXT variable. I've done Find In searches for the variable but that has not led me to the code that generates the emails. Any suggestions for how to find it is appreciated!



      Here is the code snippet with the email body variable:



      &EMAIL_TEXT = "Please review and take approval action for the following:" | Char(10) | "Business Unit: " | VCHR_APPRVL.BUSINESS_UNIT.Value | Char(10) | "Voucher ID: " | VCHR_APPRVL.VOUCHER_ID | Char(10) | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "The following hyperlink will take you to the voucher approval page:" | Char(10);
      &URL = GenerateComponentPortalURL("EMPLOYEE", Node.ERP, MenuName.ENTER_VOUCHER_INFORMATION, "GBL", Component.VCHR_APPROVE, Page.VCHR_APPRVL_WF, "U", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID);
      &EMAIL_TEXT = &EMAIL_TEXT | &URL | Char(10);

      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "Questions pertaining to this data should be directed to AccountsPayable_GH@guthrie.org" | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "****DO NOT REPLY TO THIS EMAIL AS THIS ACCOUNT IS NOT MONITORED****" | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      GH_VCHR_APR_WRK.EMAILTEXT.Value = &EMAIL_TEXT;


      Here is the entire Record PeopleCode (for context) on the field BUSPROCNAME with the SaveEdit action:



      Declare Function virtual_approver PeopleCode APPR_VA0_WRK.FUNCLIB_01 FieldFormula;
      Declare Function get_roleuser PeopleCode APPR_VA0_WRK.ROLEUSER FieldChange;
      Declare Function get_message_text PeopleCode WF_FUNCLIB_WRK.FUNCLIB_01 FieldFormula;

      Component boolean &overrideapprover;

      Function get_denial_role();
      &SETID = GetSetId(Field.BUSINESS_UNIT, VCHR_APPRVL.BUSINESS_UNIT, Record.BUS_UNIT_OPT_AP, "");
      &CURRDATE = %Date;
      SQLExec("Select a.rolename from ps_bus_unit_opt_ap a where a.setid = :1 and a.effdt = (Select max(b.effdt) from ps_bus_unit_opt_ap b where b.setid = :2 and b.effdt <= %datein(:3) and b.eff_status = 'A')", &SETID, &SETID, &CURRDATE, APPR_FIELDS_WRK.ROLENAME);
      End-Function;

      Function get_deptid(&BU, &Voucher_ID, &Dept_Cnt, &DEPTID);
      Local SQL &SQL_DEPTID;
      &Dept_Cnt = 0;
      /* If &VOUCHER_STYLE = "JRNL" Or
      &VOUCHER_STYLE = "CORR" Or
      &VOUCHER_STYLE = "ADJ" Then
      MessageBox(0, "", 0, 0, "Jrnl or Adj or Reversal. So assigning 99999", 0);
      &DEPTID = "99999";
      &Dept_Cnt = 1;
      Else */
      SQLExec("SELECT DEPTID FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", &BU, &Voucher_ID, &DEPTID);
      If All(&DEPTID) Then
      &Dept_Cnt = 1;
      Else
      &SQL_DEPTID = CreateSQL("SELECT DISTINCT DEPTID FROM PS_DISTRIB_LINE A, PS_PO_LINE B WHERE A.BUSINESS_UNIT = :1 AND VOUCHER_ID = :2 AND A.BUSINESS_UNIT_PO = B.BUSINESS_UNIT AND A.PO_ID = B.PO_ID AND A.LINE_NBR = B.LINE_NBR AND B.RECV_REQ <> 'Y'", &BU, &Voucher_ID);
      While &SQL_DEPTID.Fetch(&DEPTID_Fetch)
      &Dept_Cnt = &Dept_Cnt + 1;
      &DEPTID = &DEPTID_Fetch;
      End-While;
      End-If;
      rem End-If;
      End-Function;


      /* ---------------- beginning of mainline --------------------------*/
      /* ICE 597971000 - TMG - 06/17/03 */
      /* Check if nothing has changed on the approval status */
      If Not FieldChanged(VCHR_APPRVL.APPR_STATUS) Then
      Error MsgGet(7045, 5, "The approval status has not been changed/updated, page cannot be saved until the approval status has been modified.!");
      End-If;

      If VCHR_APPRVL.APPR_STATUS = "D" And
      VCHR_FS.APPR_INSTANCE = 0 Then
      Error MsgGet(7045, 7, "The voucher cannot be Denied until it has been routed.");
      End-If;


      /* ICE 531713000 - TMG - 12/13/02 */
      /* Check if voucher status has changed */

      rem SQLExec("SELECT ENTRY_STATUS, CLOSE_STATUS, PROCESS_MAN_CLOSE FROM PS_VOUCHER WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &ENTRY_STATUS, &CLOSE_STATUS, &PROCESS_MAN_CLOSE);
      SQLExec("SELECT ENTRY_STATUS, CLOSE_STATUS, PROCESS_MAN_CLOSE, VOUCHER_STYLE FROM PS_VOUCHER WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &ENTRY_STATUS, &CLOSE_STATUS, &PROCESS_MAN_CLOSE, &VOUCHER_STYLE);

      If &ENTRY_STATUS = "P" And
      &CLOSE_STATUS <> "C" And
      &PROCESS_MAN_CLOSE <> "Y" Then

      /* Check if worklist item has been cancelled */
      &INSTANCEID = %WLInstanceId;
      If All(&INSTANCEID) Then
      SQLExec("SELECT MAX(A.ACTIVITYNAME), MAX(A.EVENTNAME), MAX(A.WORKLISTNAME) FROM PS_VCHR_WL1 A, PSWORKLIST B WHERE A.BUSPROCNAME = B.BUSPROCNAME AND A.ACTIVITYNAME = B.ACTIVITYNAME AND A.EVENTNAME = B.EVENTNAME AND A.WORKLISTNAME = B.WORKLISTNAME AND A.INSTANCEID = B.INSTANCEID AND A.BUSPROCNAME = :1 AND A.BUSINESS_UNIT = :2 AND A.VOUCHER_ID = :3 AND A.INSTANCEID = :4", VCHR_APPRVL.BUSPROCNAME, VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &INSTANCEID, &ACTIVITYNAME, &EVENTNAME, &WORKLISTNAME);

      SQLExec("SELECT INSTSTATUS FROM PSWORKLIST WHERE BUSPROCNAME = :1 AND ACTIVITYNAME = :2 AND EVENTNAME = :3 AND WORKLISTNAME = :4 AND INSTANCEID = :5", VCHR_APPRVL.BUSPROCNAME, &ACTIVITYNAME, &EVENTNAME, &WORKLISTNAME, &INSTANCEID, &INSTSTATUS);

      If &INSTSTATUS = 3 Then
      Error MsgGet(7045, 4, "Voucher approval status cannot be changed because worklist item has been cancelled.")
      End-If;
      End-If;
      Else
      Error MsgGet(7045, 3, "Voucher approval status cannot be changed because voucher status has changed.");
      End-If;

      /* If (APPR_STATUS = "A" And
      %MessageAgent = "") Or
      (APPR_STATUS = "P" And
      %MessageAgent <> "") Then */
      If VCHR_APPRVL.APPR_STATUS = "A" And
      %CompIntfcName <> "" Or
      VCHR_APPRVL.APPR_STATUS = "D" Then
      If &overrideapprover = True Then
      rem &OPRID = ""; /*custom commented this line and added the next*/
      &OPRID = VCHR_FS.OPRID;
      Else
      &OPRID = %OperatorId;
      End-If;
      get_roleuser(&OPRID, &EMAILID, &FORMID, &EMPLID, &ROLEUSER);
      rem the following four fields are required;
      APPR_FIELDS_WRK.BUSPROCNAME = VCHR_APPRVL.BUSPROCNAME;
      APPR_FIELDS_WRK.APPR_RULE_SET = VCHR_APPRVL.APPR_RULE_SET;
      APPR_FIELDS_WRK.ROLEUSER = &ROLEUSER;
      APPR_FIELDS_WRK.APPR_INSTANCE = VCHR_APPRVL.APPR_INSTANCE;
      SQLExec("SELECT GH_BUSINESS_UNIT_O FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", &BU, &Voucher_ID, &GH_BUSINESS_UNIT_O); */
      SQLExec("SELECT GH_BUSINESS_UNIT_O FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &GH_BUSINESS_UNIT_O);
      VCHR_APPRVL_WRK.GH_BUSINESS_UNIT_O.Value = &GH_BUSINESS_UNIT_O;
      get_deptid(VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &Dept_Cnt, &DEPTID);

      &EMAIL_TEXT = "Please review and take approval action for the following:" | Char(10) | "Business Unit: " | VCHR_APPRVL.BUSINESS_UNIT.Value | Char(10) | "Voucher ID: " | VCHR_APPRVL.VOUCHER_ID | Char(10) | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "The following hyperlink will take you to the voucher approval page:" | Char(10);
      &URL = GenerateComponentPortalURL("EMPLOYEE", Node.ERP, MenuName.ENTER_VOUCHER_INFORMATION, "GBL", Component.VCHR_APPROVE, Page.VCHR_APPRVL_WF, "U", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID);
      &EMAIL_TEXT = &EMAIL_TEXT | &URL | Char(10);

      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "Questions pertaining to this data should be directed to AccountsPayable_GH@guthrie.org" | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "****DO NOT REPLY TO THIS EMAIL AS THIS ACCOUNT IS NOT MONITORED****" | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      GH_VCHR_APR_WRK.EMAILTEXT.Value = &EMAIL_TEXT;

      If None(&DEPTID) Then
      REM VCHR_APPRVL_WRK.DEPTID.Value = "99999";
      MessageBox(0, "", 0, 0, "No Deptid. So assigning 99999", 0);
      VCHR_APPRVL_WRK.DEPTID.Value = "99999";
      Else
      VCHR_APPRVL_WRK.DEPTID.Value = &DEPTID;
      End-If;
      If VCHR_APPRVL.APPR_STATUS = "D" Then
      APPR_FIELDS_WRK.APPR_ACTION = "D";
      Else
      APPR_FIELDS_WRK.APPR_ACTION = "A";
      End-If;
      If VCHR_APPRVL.APPR_STATUS = "A" Then
      VCHR_APPRVL.APPR_STATUS = "P";
      End-If;
      virtual_approver();
      If &overrideapprover = True Then
      &overrideapprover = False;
      End-If;
      VCHR_APPRVL.APPR_CHECK_FLG = "Y";
      rem;
      VCHR_APPRVL.APPR_STATUS = APPR_FIELDS_WRK.APPR_STATUS;
      remark set up the message for e-mail if denied;
      If VCHR_APPRVL.APPR_STATUS = "D" Then
      &LANGUAGE_CD = PSOPTIONS.LANGUAGE_CD;
      &MESSAGE_SET_NBR = 7045;
      &MESSAGE_NBR = 2;
      &BIND1 = VCHR_FS.BUSINESS_UNIT | "/" | VCHR_FS.VOUCHER_ID;
      &BIND2 = APPR_FIELDS_WRK.ROLEUSER;
      &BIND3 = VCHR_FS.VENDOR_ID | ", " | VENDOR.NAME1;
      &BIND4 = VCHR_FS.INVOICE_ID | " (" | VCHR_FS.INVOICE_DT | ")";
      &BIND5 = VCHR_FS.GROSS_AMT | "(" | VCHR_FS.TXN_CURRENCY_CD | ")";
      get_message_text(&MESSAGE_SET_NBR, &MESSAGE_NBR, &BIND1, &BIND2, &BIND3, &BIND4, &BIND5, &MESSAGE_TEXT, &DESCRLONG);
      UpdateValue(VCHR_APPRVL_MSG.EMAIL_SUBJECT_LONG, 1, &DESCRLONG);
      UpdateValue(VCHR_APPRVL_MSG.EMAIL_TEXTLONG, 1, &MESSAGE_TEXT);
      remark get the role to send denials to;
      get_denial_role();
      VCHR_APPRVL_WRK.RTE_CNTL_TYPE1 = "Business Unit";
      VCHR_APPRVL_WRK.RTE_CNTL_TYPE2 = "Administrative Area";
      VCHR_APPRVL_WRK.WF_ADMIN_AREA = "AP";
      VCHR_APPRVL_WRK.ROLENAME = APPR_FIELDS_WRK.ROLENAME;
      End-If;
      End-If;









      share|improve this question













      We have custom functionality in PeopleSoft FSCM that generates an email notification with a link to direct users to approve vouchers online. I have found part of the text string variable that compose the email message within the following Record PeopleCode, however I can not seem to find where the actual outbound email object is created and Send method is being called and using the &EMAIL_TEXT variable. I've done Find In searches for the variable but that has not led me to the code that generates the emails. Any suggestions for how to find it is appreciated!



      Here is the code snippet with the email body variable:



      &EMAIL_TEXT = "Please review and take approval action for the following:" | Char(10) | "Business Unit: " | VCHR_APPRVL.BUSINESS_UNIT.Value | Char(10) | "Voucher ID: " | VCHR_APPRVL.VOUCHER_ID | Char(10) | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "The following hyperlink will take you to the voucher approval page:" | Char(10);
      &URL = GenerateComponentPortalURL("EMPLOYEE", Node.ERP, MenuName.ENTER_VOUCHER_INFORMATION, "GBL", Component.VCHR_APPROVE, Page.VCHR_APPRVL_WF, "U", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID);
      &EMAIL_TEXT = &EMAIL_TEXT | &URL | Char(10);

      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "Questions pertaining to this data should be directed to AccountsPayable_GH@guthrie.org" | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "****DO NOT REPLY TO THIS EMAIL AS THIS ACCOUNT IS NOT MONITORED****" | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      GH_VCHR_APR_WRK.EMAILTEXT.Value = &EMAIL_TEXT;


      Here is the entire Record PeopleCode (for context) on the field BUSPROCNAME with the SaveEdit action:



      Declare Function virtual_approver PeopleCode APPR_VA0_WRK.FUNCLIB_01 FieldFormula;
      Declare Function get_roleuser PeopleCode APPR_VA0_WRK.ROLEUSER FieldChange;
      Declare Function get_message_text PeopleCode WF_FUNCLIB_WRK.FUNCLIB_01 FieldFormula;

      Component boolean &overrideapprover;

      Function get_denial_role();
      &SETID = GetSetId(Field.BUSINESS_UNIT, VCHR_APPRVL.BUSINESS_UNIT, Record.BUS_UNIT_OPT_AP, "");
      &CURRDATE = %Date;
      SQLExec("Select a.rolename from ps_bus_unit_opt_ap a where a.setid = :1 and a.effdt = (Select max(b.effdt) from ps_bus_unit_opt_ap b where b.setid = :2 and b.effdt <= %datein(:3) and b.eff_status = 'A')", &SETID, &SETID, &CURRDATE, APPR_FIELDS_WRK.ROLENAME);
      End-Function;

      Function get_deptid(&BU, &Voucher_ID, &Dept_Cnt, &DEPTID);
      Local SQL &SQL_DEPTID;
      &Dept_Cnt = 0;
      /* If &VOUCHER_STYLE = "JRNL" Or
      &VOUCHER_STYLE = "CORR" Or
      &VOUCHER_STYLE = "ADJ" Then
      MessageBox(0, "", 0, 0, "Jrnl or Adj or Reversal. So assigning 99999", 0);
      &DEPTID = "99999";
      &Dept_Cnt = 1;
      Else */
      SQLExec("SELECT DEPTID FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", &BU, &Voucher_ID, &DEPTID);
      If All(&DEPTID) Then
      &Dept_Cnt = 1;
      Else
      &SQL_DEPTID = CreateSQL("SELECT DISTINCT DEPTID FROM PS_DISTRIB_LINE A, PS_PO_LINE B WHERE A.BUSINESS_UNIT = :1 AND VOUCHER_ID = :2 AND A.BUSINESS_UNIT_PO = B.BUSINESS_UNIT AND A.PO_ID = B.PO_ID AND A.LINE_NBR = B.LINE_NBR AND B.RECV_REQ <> 'Y'", &BU, &Voucher_ID);
      While &SQL_DEPTID.Fetch(&DEPTID_Fetch)
      &Dept_Cnt = &Dept_Cnt + 1;
      &DEPTID = &DEPTID_Fetch;
      End-While;
      End-If;
      rem End-If;
      End-Function;


      /* ---------------- beginning of mainline --------------------------*/
      /* ICE 597971000 - TMG - 06/17/03 */
      /* Check if nothing has changed on the approval status */
      If Not FieldChanged(VCHR_APPRVL.APPR_STATUS) Then
      Error MsgGet(7045, 5, "The approval status has not been changed/updated, page cannot be saved until the approval status has been modified.!");
      End-If;

      If VCHR_APPRVL.APPR_STATUS = "D" And
      VCHR_FS.APPR_INSTANCE = 0 Then
      Error MsgGet(7045, 7, "The voucher cannot be Denied until it has been routed.");
      End-If;


      /* ICE 531713000 - TMG - 12/13/02 */
      /* Check if voucher status has changed */

      rem SQLExec("SELECT ENTRY_STATUS, CLOSE_STATUS, PROCESS_MAN_CLOSE FROM PS_VOUCHER WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &ENTRY_STATUS, &CLOSE_STATUS, &PROCESS_MAN_CLOSE);
      SQLExec("SELECT ENTRY_STATUS, CLOSE_STATUS, PROCESS_MAN_CLOSE, VOUCHER_STYLE FROM PS_VOUCHER WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &ENTRY_STATUS, &CLOSE_STATUS, &PROCESS_MAN_CLOSE, &VOUCHER_STYLE);

      If &ENTRY_STATUS = "P" And
      &CLOSE_STATUS <> "C" And
      &PROCESS_MAN_CLOSE <> "Y" Then

      /* Check if worklist item has been cancelled */
      &INSTANCEID = %WLInstanceId;
      If All(&INSTANCEID) Then
      SQLExec("SELECT MAX(A.ACTIVITYNAME), MAX(A.EVENTNAME), MAX(A.WORKLISTNAME) FROM PS_VCHR_WL1 A, PSWORKLIST B WHERE A.BUSPROCNAME = B.BUSPROCNAME AND A.ACTIVITYNAME = B.ACTIVITYNAME AND A.EVENTNAME = B.EVENTNAME AND A.WORKLISTNAME = B.WORKLISTNAME AND A.INSTANCEID = B.INSTANCEID AND A.BUSPROCNAME = :1 AND A.BUSINESS_UNIT = :2 AND A.VOUCHER_ID = :3 AND A.INSTANCEID = :4", VCHR_APPRVL.BUSPROCNAME, VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &INSTANCEID, &ACTIVITYNAME, &EVENTNAME, &WORKLISTNAME);

      SQLExec("SELECT INSTSTATUS FROM PSWORKLIST WHERE BUSPROCNAME = :1 AND ACTIVITYNAME = :2 AND EVENTNAME = :3 AND WORKLISTNAME = :4 AND INSTANCEID = :5", VCHR_APPRVL.BUSPROCNAME, &ACTIVITYNAME, &EVENTNAME, &WORKLISTNAME, &INSTANCEID, &INSTSTATUS);

      If &INSTSTATUS = 3 Then
      Error MsgGet(7045, 4, "Voucher approval status cannot be changed because worklist item has been cancelled.")
      End-If;
      End-If;
      Else
      Error MsgGet(7045, 3, "Voucher approval status cannot be changed because voucher status has changed.");
      End-If;

      /* If (APPR_STATUS = "A" And
      %MessageAgent = "") Or
      (APPR_STATUS = "P" And
      %MessageAgent <> "") Then */
      If VCHR_APPRVL.APPR_STATUS = "A" And
      %CompIntfcName <> "" Or
      VCHR_APPRVL.APPR_STATUS = "D" Then
      If &overrideapprover = True Then
      rem &OPRID = ""; /*custom commented this line and added the next*/
      &OPRID = VCHR_FS.OPRID;
      Else
      &OPRID = %OperatorId;
      End-If;
      get_roleuser(&OPRID, &EMAILID, &FORMID, &EMPLID, &ROLEUSER);
      rem the following four fields are required;
      APPR_FIELDS_WRK.BUSPROCNAME = VCHR_APPRVL.BUSPROCNAME;
      APPR_FIELDS_WRK.APPR_RULE_SET = VCHR_APPRVL.APPR_RULE_SET;
      APPR_FIELDS_WRK.ROLEUSER = &ROLEUSER;
      APPR_FIELDS_WRK.APPR_INSTANCE = VCHR_APPRVL.APPR_INSTANCE;
      SQLExec("SELECT GH_BUSINESS_UNIT_O FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", &BU, &Voucher_ID, &GH_BUSINESS_UNIT_O); */
      SQLExec("SELECT GH_BUSINESS_UNIT_O FROM PS_GH_VCHAPPR_DEPT WHERE BUSINESS_UNIT = :1 AND VOUCHER_ID = :2", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &GH_BUSINESS_UNIT_O);
      VCHR_APPRVL_WRK.GH_BUSINESS_UNIT_O.Value = &GH_BUSINESS_UNIT_O;
      get_deptid(VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID, &Dept_Cnt, &DEPTID);

      &EMAIL_TEXT = "Please review and take approval action for the following:" | Char(10) | "Business Unit: " | VCHR_APPRVL.BUSINESS_UNIT.Value | Char(10) | "Voucher ID: " | VCHR_APPRVL.VOUCHER_ID | Char(10) | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "The following hyperlink will take you to the voucher approval page:" | Char(10);
      &URL = GenerateComponentPortalURL("EMPLOYEE", Node.ERP, MenuName.ENTER_VOUCHER_INFORMATION, "GBL", Component.VCHR_APPROVE, Page.VCHR_APPRVL_WF, "U", VCHR_APPRVL.BUSINESS_UNIT, VCHR_APPRVL.VOUCHER_ID);
      &EMAIL_TEXT = &EMAIL_TEXT | &URL | Char(10);

      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "Questions pertaining to this data should be directed to AccountsPayable_GH@guthrie.org" | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | "****DO NOT REPLY TO THIS EMAIL AS THIS ACCOUNT IS NOT MONITORED****" | Char(10);
      &EMAIL_TEXT = &EMAIL_TEXT | Char(10) | Char(10);
      GH_VCHR_APR_WRK.EMAILTEXT.Value = &EMAIL_TEXT;

      If None(&DEPTID) Then
      REM VCHR_APPRVL_WRK.DEPTID.Value = "99999";
      MessageBox(0, "", 0, 0, "No Deptid. So assigning 99999", 0);
      VCHR_APPRVL_WRK.DEPTID.Value = "99999";
      Else
      VCHR_APPRVL_WRK.DEPTID.Value = &DEPTID;
      End-If;
      If VCHR_APPRVL.APPR_STATUS = "D" Then
      APPR_FIELDS_WRK.APPR_ACTION = "D";
      Else
      APPR_FIELDS_WRK.APPR_ACTION = "A";
      End-If;
      If VCHR_APPRVL.APPR_STATUS = "A" Then
      VCHR_APPRVL.APPR_STATUS = "P";
      End-If;
      virtual_approver();
      If &overrideapprover = True Then
      &overrideapprover = False;
      End-If;
      VCHR_APPRVL.APPR_CHECK_FLG = "Y";
      rem;
      VCHR_APPRVL.APPR_STATUS = APPR_FIELDS_WRK.APPR_STATUS;
      remark set up the message for e-mail if denied;
      If VCHR_APPRVL.APPR_STATUS = "D" Then
      &LANGUAGE_CD = PSOPTIONS.LANGUAGE_CD;
      &MESSAGE_SET_NBR = 7045;
      &MESSAGE_NBR = 2;
      &BIND1 = VCHR_FS.BUSINESS_UNIT | "/" | VCHR_FS.VOUCHER_ID;
      &BIND2 = APPR_FIELDS_WRK.ROLEUSER;
      &BIND3 = VCHR_FS.VENDOR_ID | ", " | VENDOR.NAME1;
      &BIND4 = VCHR_FS.INVOICE_ID | " (" | VCHR_FS.INVOICE_DT | ")";
      &BIND5 = VCHR_FS.GROSS_AMT | "(" | VCHR_FS.TXN_CURRENCY_CD | ")";
      get_message_text(&MESSAGE_SET_NBR, &MESSAGE_NBR, &BIND1, &BIND2, &BIND3, &BIND4, &BIND5, &MESSAGE_TEXT, &DESCRLONG);
      UpdateValue(VCHR_APPRVL_MSG.EMAIL_SUBJECT_LONG, 1, &DESCRLONG);
      UpdateValue(VCHR_APPRVL_MSG.EMAIL_TEXTLONG, 1, &MESSAGE_TEXT);
      remark get the role to send denials to;
      get_denial_role();
      VCHR_APPRVL_WRK.RTE_CNTL_TYPE1 = "Business Unit";
      VCHR_APPRVL_WRK.RTE_CNTL_TYPE2 = "Administrative Area";
      VCHR_APPRVL_WRK.WF_ADMIN_AREA = "AP";
      VCHR_APPRVL_WRK.ROLENAME = APPR_FIELDS_WRK.ROLENAME;
      End-If;
      End-If;






      peoplesoft peoplecode






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 at 15:29









      Nick

      1418




      1418
























          1 Answer
          1






          active

          oldest

          votes


















          2














          The email text is being saved into a work record field, so the sendmail call doesn't have to be in this event. (It isn't in the code you provided)



          In the Component Processor Flow, after SaveEdit there's SavePreChange, Workflow and SavePostChange, but since it is saved in a work record, it's also possible that additional user input is required after the Save Processing flow and therefor it could literally be anywhere.






          share|improve this answer





















          • Peter thanks for the feedback - So there isn't a way to track this down easily? I thought the variables that compose the email message &EMAIL_TEXT would be referenced again somewhere where the SendMail function is being called.
            – Nick
            Nov 28 at 18:24






          • 1




            @Nick The variable is local and won't be used where SendMail() is called. What will be used (or put into another variable) is GH_VCHR_APR_WRK.EMAILTEXT. I'm not sure how often the work record is used in your environment, but a 'Find In...' for 'GH_VCHR_APR_WRK.EMAILTEXT.Value' might work. If there are too many hits for that, you'll have to follow the component processor flow.
            – Peter Paff
            Nov 29 at 8:35












          • I did a Find In search for GH_VCHR_APR_WRK.EMAILTEXT however the only result it finds is the current Record PeopleCode referenced in my original post. I'll keep looking, I will admit though it is frustrating being able to find things like this. I don't see &EMAIL_TEXT being declared as a variable, it must default to local if it isn't explicitly declared?
            – Nick
            Nov 30 at 20:36








          • 1




            @Nick Yes if you don't explicitely declare a variable it defaults to local and the type you assign to it first. You can try opening GH_VCHR_APR_WRK, right click EMAILTEXT and 'Find Definition References - Record-Field'
            – Peter Paff
            Dec 3 at 8:24










          • Bingo! I found that it's used as a Activity definition. This is brand new to me, so this will be interesting to learn! Thanks Peter.
            – Nick
            Dec 3 at 13:28











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396330%2ffind-sendmail-peoplecode%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          The email text is being saved into a work record field, so the sendmail call doesn't have to be in this event. (It isn't in the code you provided)



          In the Component Processor Flow, after SaveEdit there's SavePreChange, Workflow and SavePostChange, but since it is saved in a work record, it's also possible that additional user input is required after the Save Processing flow and therefor it could literally be anywhere.






          share|improve this answer





















          • Peter thanks for the feedback - So there isn't a way to track this down easily? I thought the variables that compose the email message &EMAIL_TEXT would be referenced again somewhere where the SendMail function is being called.
            – Nick
            Nov 28 at 18:24






          • 1




            @Nick The variable is local and won't be used where SendMail() is called. What will be used (or put into another variable) is GH_VCHR_APR_WRK.EMAILTEXT. I'm not sure how often the work record is used in your environment, but a 'Find In...' for 'GH_VCHR_APR_WRK.EMAILTEXT.Value' might work. If there are too many hits for that, you'll have to follow the component processor flow.
            – Peter Paff
            Nov 29 at 8:35












          • I did a Find In search for GH_VCHR_APR_WRK.EMAILTEXT however the only result it finds is the current Record PeopleCode referenced in my original post. I'll keep looking, I will admit though it is frustrating being able to find things like this. I don't see &EMAIL_TEXT being declared as a variable, it must default to local if it isn't explicitly declared?
            – Nick
            Nov 30 at 20:36








          • 1




            @Nick Yes if you don't explicitely declare a variable it defaults to local and the type you assign to it first. You can try opening GH_VCHR_APR_WRK, right click EMAILTEXT and 'Find Definition References - Record-Field'
            – Peter Paff
            Dec 3 at 8:24










          • Bingo! I found that it's used as a Activity definition. This is brand new to me, so this will be interesting to learn! Thanks Peter.
            – Nick
            Dec 3 at 13:28
















          2














          The email text is being saved into a work record field, so the sendmail call doesn't have to be in this event. (It isn't in the code you provided)



          In the Component Processor Flow, after SaveEdit there's SavePreChange, Workflow and SavePostChange, but since it is saved in a work record, it's also possible that additional user input is required after the Save Processing flow and therefor it could literally be anywhere.






          share|improve this answer





















          • Peter thanks for the feedback - So there isn't a way to track this down easily? I thought the variables that compose the email message &EMAIL_TEXT would be referenced again somewhere where the SendMail function is being called.
            – Nick
            Nov 28 at 18:24






          • 1




            @Nick The variable is local and won't be used where SendMail() is called. What will be used (or put into another variable) is GH_VCHR_APR_WRK.EMAILTEXT. I'm not sure how often the work record is used in your environment, but a 'Find In...' for 'GH_VCHR_APR_WRK.EMAILTEXT.Value' might work. If there are too many hits for that, you'll have to follow the component processor flow.
            – Peter Paff
            Nov 29 at 8:35












          • I did a Find In search for GH_VCHR_APR_WRK.EMAILTEXT however the only result it finds is the current Record PeopleCode referenced in my original post. I'll keep looking, I will admit though it is frustrating being able to find things like this. I don't see &EMAIL_TEXT being declared as a variable, it must default to local if it isn't explicitly declared?
            – Nick
            Nov 30 at 20:36








          • 1




            @Nick Yes if you don't explicitely declare a variable it defaults to local and the type you assign to it first. You can try opening GH_VCHR_APR_WRK, right click EMAILTEXT and 'Find Definition References - Record-Field'
            – Peter Paff
            Dec 3 at 8:24










          • Bingo! I found that it's used as a Activity definition. This is brand new to me, so this will be interesting to learn! Thanks Peter.
            – Nick
            Dec 3 at 13:28














          2












          2








          2






          The email text is being saved into a work record field, so the sendmail call doesn't have to be in this event. (It isn't in the code you provided)



          In the Component Processor Flow, after SaveEdit there's SavePreChange, Workflow and SavePostChange, but since it is saved in a work record, it's also possible that additional user input is required after the Save Processing flow and therefor it could literally be anywhere.






          share|improve this answer












          The email text is being saved into a work record field, so the sendmail call doesn't have to be in this event. (It isn't in the code you provided)



          In the Component Processor Flow, after SaveEdit there's SavePreChange, Workflow and SavePostChange, but since it is saved in a work record, it's also possible that additional user input is required after the Save Processing flow and therefor it could literally be anywhere.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 at 9:30









          Peter Paff

          13410




          13410












          • Peter thanks for the feedback - So there isn't a way to track this down easily? I thought the variables that compose the email message &EMAIL_TEXT would be referenced again somewhere where the SendMail function is being called.
            – Nick
            Nov 28 at 18:24






          • 1




            @Nick The variable is local and won't be used where SendMail() is called. What will be used (or put into another variable) is GH_VCHR_APR_WRK.EMAILTEXT. I'm not sure how often the work record is used in your environment, but a 'Find In...' for 'GH_VCHR_APR_WRK.EMAILTEXT.Value' might work. If there are too many hits for that, you'll have to follow the component processor flow.
            – Peter Paff
            Nov 29 at 8:35












          • I did a Find In search for GH_VCHR_APR_WRK.EMAILTEXT however the only result it finds is the current Record PeopleCode referenced in my original post. I'll keep looking, I will admit though it is frustrating being able to find things like this. I don't see &EMAIL_TEXT being declared as a variable, it must default to local if it isn't explicitly declared?
            – Nick
            Nov 30 at 20:36








          • 1




            @Nick Yes if you don't explicitely declare a variable it defaults to local and the type you assign to it first. You can try opening GH_VCHR_APR_WRK, right click EMAILTEXT and 'Find Definition References - Record-Field'
            – Peter Paff
            Dec 3 at 8:24










          • Bingo! I found that it's used as a Activity definition. This is brand new to me, so this will be interesting to learn! Thanks Peter.
            – Nick
            Dec 3 at 13:28


















          • Peter thanks for the feedback - So there isn't a way to track this down easily? I thought the variables that compose the email message &EMAIL_TEXT would be referenced again somewhere where the SendMail function is being called.
            – Nick
            Nov 28 at 18:24






          • 1




            @Nick The variable is local and won't be used where SendMail() is called. What will be used (or put into another variable) is GH_VCHR_APR_WRK.EMAILTEXT. I'm not sure how often the work record is used in your environment, but a 'Find In...' for 'GH_VCHR_APR_WRK.EMAILTEXT.Value' might work. If there are too many hits for that, you'll have to follow the component processor flow.
            – Peter Paff
            Nov 29 at 8:35












          • I did a Find In search for GH_VCHR_APR_WRK.EMAILTEXT however the only result it finds is the current Record PeopleCode referenced in my original post. I'll keep looking, I will admit though it is frustrating being able to find things like this. I don't see &EMAIL_TEXT being declared as a variable, it must default to local if it isn't explicitly declared?
            – Nick
            Nov 30 at 20:36








          • 1




            @Nick Yes if you don't explicitely declare a variable it defaults to local and the type you assign to it first. You can try opening GH_VCHR_APR_WRK, right click EMAILTEXT and 'Find Definition References - Record-Field'
            – Peter Paff
            Dec 3 at 8:24










          • Bingo! I found that it's used as a Activity definition. This is brand new to me, so this will be interesting to learn! Thanks Peter.
            – Nick
            Dec 3 at 13:28
















          Peter thanks for the feedback - So there isn't a way to track this down easily? I thought the variables that compose the email message &EMAIL_TEXT would be referenced again somewhere where the SendMail function is being called.
          – Nick
          Nov 28 at 18:24




          Peter thanks for the feedback - So there isn't a way to track this down easily? I thought the variables that compose the email message &EMAIL_TEXT would be referenced again somewhere where the SendMail function is being called.
          – Nick
          Nov 28 at 18:24




          1




          1




          @Nick The variable is local and won't be used where SendMail() is called. What will be used (or put into another variable) is GH_VCHR_APR_WRK.EMAILTEXT. I'm not sure how often the work record is used in your environment, but a 'Find In...' for 'GH_VCHR_APR_WRK.EMAILTEXT.Value' might work. If there are too many hits for that, you'll have to follow the component processor flow.
          – Peter Paff
          Nov 29 at 8:35






          @Nick The variable is local and won't be used where SendMail() is called. What will be used (or put into another variable) is GH_VCHR_APR_WRK.EMAILTEXT. I'm not sure how often the work record is used in your environment, but a 'Find In...' for 'GH_VCHR_APR_WRK.EMAILTEXT.Value' might work. If there are too many hits for that, you'll have to follow the component processor flow.
          – Peter Paff
          Nov 29 at 8:35














          I did a Find In search for GH_VCHR_APR_WRK.EMAILTEXT however the only result it finds is the current Record PeopleCode referenced in my original post. I'll keep looking, I will admit though it is frustrating being able to find things like this. I don't see &EMAIL_TEXT being declared as a variable, it must default to local if it isn't explicitly declared?
          – Nick
          Nov 30 at 20:36






          I did a Find In search for GH_VCHR_APR_WRK.EMAILTEXT however the only result it finds is the current Record PeopleCode referenced in my original post. I'll keep looking, I will admit though it is frustrating being able to find things like this. I don't see &EMAIL_TEXT being declared as a variable, it must default to local if it isn't explicitly declared?
          – Nick
          Nov 30 at 20:36






          1




          1




          @Nick Yes if you don't explicitely declare a variable it defaults to local and the type you assign to it first. You can try opening GH_VCHR_APR_WRK, right click EMAILTEXT and 'Find Definition References - Record-Field'
          – Peter Paff
          Dec 3 at 8:24




          @Nick Yes if you don't explicitely declare a variable it defaults to local and the type you assign to it first. You can try opening GH_VCHR_APR_WRK, right click EMAILTEXT and 'Find Definition References - Record-Field'
          – Peter Paff
          Dec 3 at 8:24












          Bingo! I found that it's used as a Activity definition. This is brand new to me, so this will be interesting to learn! Thanks Peter.
          – Nick
          Dec 3 at 13:28




          Bingo! I found that it's used as a Activity definition. This is brand new to me, so this will be interesting to learn! Thanks Peter.
          – Nick
          Dec 3 at 13:28


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396330%2ffind-sendmail-peoplecode%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Create new schema in PostgreSQL using DBeaver

          Deepest pit of an array with Javascript: test on Codility

          Fotorealismo