Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Sending an Email Using Generic Templates in PeopleSoft ?

What is Generic Template? 

With the Generic templates feature, you can conveniently customize content directly within the PeopleSoft Internet Architecture (PIA). This approach diminishes the reliance on technical developers within the PeopleSoft environment. By employing Bind variables, you can dynamically alter the values. 

How to Create a Generic Template? 

To create a Generic templates, follow these steps: 

  • Navigate to: PeopleTools > Workflow > Notifications > Generic Templates 

Most of the time we use sendmail function but that has been degraded in peoplesoft from 8.60 and replaced by MCFOutboundEmail . Even the PT_WF_NOTIFICATION package used MCF function 

You can use the below code in any application engine by simply modifying few variables

/* Importing the necessary packages */ 

import PT_WF_NOTIFICATION:NotificationAddress; 

import PT_WF_NOTIFICATION:Notification; 

import PT_WF_NOTIFICATION:NotificationTemplate; 

/* Declaring variables */ 

Local array of string &aryValues; 

Local array of PT_WF_NOTIFICATION:NotificationAddress &mynotifyto, &mynotifycc, &mynotifyfrom; 

Local PT_WF_NOTIFICATION:NotificationAddress &mynotifyaddress, &mynotifyaddress1; 

Local PT_WF_NOTIFICATION:Notification &mynotification; 

Local string &emailid2; 

/* Hardcoding email IDs */ 

&emailid = "********@mail.com"; 

&emailid1 = "********@mail.com"; 

/* Initializing an array for "to-email" */ 

&mynotifyto = CreateArrayRept(&mynotifyaddress, 0); 

&mynotifyaddress = create PT_WF_NOTIFICATION:NotificationAddress("", "", "", &emailid, "Email"); 

&mynotifyto.Push(&mynotifyaddress); 

/* Initializing an array for "cc-email" */ 

&mynotifycc = CreateArrayRept(&mynotifyaddress1, 0); 

&mynotifyaddress1 = create PT_WF_NOTIFICATION:NotificationAddress("", "", "", &emailid1, "Email"); 

&mynotifycc.Push(&mynotifyaddress1); 

/* Initializing a template array */ 

&mynotifytemplate = create PT_WF_NOTIFICATION:NotificationTemplate("", "", "Z_SAMPLE_MAIL", "G"); 

/* Populating an array with values needed for the template */ 

&aryValues = CreateArrayRept("", 0); 

&aryValues.Push("peoplesoft user"); 

&aryValues.Push("jayaraj"); 

&xmlVars = &mynotifytemplate.SetupGenericVars(&aryValues); 

&mynotifytemplate.GetAndExpandTemplate(%Language, &xmlVars); 

/* At this point, the &mynotifytemplate should have every value resolved */ 

&mynotification = create PT_WF_NOTIFICATION:Notification("sourceperson@peoplesoft.com", %Date + %PerfTime, %Language); 

/* Setting up notification parameters */ 

&mynotification.EmailReplyTo = &mynotifytemplate.SenderEmailID; 

&mynotification.NotifyTo = &mynotifyto; 

&mynotification.Subject = &mynotifytemplate.Subject; 

&mynotification.Message = &mynotifytemplate.Text; 

/* Sending the notification */
&mynotification.Send(); 

Sample Mail

We can use Data mover Script to migrate the template from one instance to other you can use the below script

Go to Source instance app designer 

GO> Data Mover 

SET LOG C:\TEMP\GEN_TEMPLATE.LOG; 

SET OUTPUT C:\TEMP\GEN_TEMPLATE.DAT; 

EXPORT PS_WL_TEMPLATE_GEN WHERE WL_TEMPLATE_ID = 'Z_SAMPLE_MAIL'; 

EXPORT PS_WL_TEMPL_GEN_TK WHERE WL_TEMPLATE_ID = 'Z_SAMPLE_MAIL'; 

EXPORT PS_WL_TEMPL_GEN_RS WHERE WL_TEMPLATE_ID = 'Z_SAMPLE_MAIL';

Now Go to Source Receiver app designer 

Go> Data Mover

SET LOG C:\TEMP\IMP_TEMPLATE.LOG; 
SET INPUT C:\TEMP\GEN_TEMPLATE.DAT; 
SET NO SPACE; 
SET NO RECORD; 
SET NO INDEX; 
IMPORT *; 

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *