查找SendMail人员代码

时间:2018-11-20 15:29:49

标签: peoplesoft peoplecode

我们在PeopleSoft FSCM中具有自定义功能,该功能可生成带有链接的电子邮件通知,以指导用户在线批准凭单。我已经在下面的Record PeopleCode中找到了组成电子邮件消息的文本字符串变量的一部分,但是我似乎找不到实际的出站电子邮件对象在何处创建并正在调用Send方法并使用&EMAIL_TEXT变量。我已经完成了“查找范围”搜索变量,但是并没有把我引到生成电子邮件的代码。任何有关如何找到它的建议都将受到赞赏!

以下是带有电子邮件正文变量的代码段:

&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;

以下是带有SaveEdit动作的BUSPROCNAME字段上的整个Record PeopleCode(用于上下文):

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;

1 个答案:

答案 0 :(得分:2)

电子邮件文本将保存到工作记录字段中,因此不必在此事件中进行sendmail呼叫。 (它不在您提供的代码中)

在组件处理器流中,在SaveEdit之后有SavePreChange,Workflow和SavePostChange,但是由于将其保存在工作记录中,因此在Save Processing流之后还可能需要其他用户输入,因此它实际上可以在任何地方。