E-WF: Using PT_WF_NOTIFICATION.Notification Class With Multiple Attachments Result in Error; " Fetching array element 1: index is not in range 1 to 0 (180,252) " (Doc ID 1508900.1)

Last updated on JANUARY 04, 2016

Applies to:

PeopleSoft Enterprise PT PeopleTools - Version 8.49 to 8.53 [Release 8.4]
Information in this document applies to any platform.


Using the PT WF Notification class, with delivered "AutomatchNotification" generic template to send out email with multiple attachments via Peoplecode event online results in error.
Fetching array element 1: index is not in range 1 to 0. (180,252)
PT_WF_NOTIFICATION.Notification.OnExecute Name:Send
PCPC:11663 Statement:240
called from:MB_ARCV_SETUP4.REFERENCE_NUMBER.SavePreChangeStatement:21

While fetching the value of an array element, the index was not within the length of the array.
PeopleTools Version; PT 8.49.23

The issue can be reproduced with the following steps:
1. Use the following code in PeopleCode Event, that utilizes the delivered "AutomatchNotification" generic template;

import PT_WF_NOTIFICATION:NotificationAddress;
import PT_WF_NOTIFICATION:Notification;
import PT_WF_NOTIFICATION:NotificationTemplate;

Local array of PT_WF_NOTIFICATION:NotificationAddress &Notifyto;
Local PT_WF_NOTIFICATION:NotificationAddress &notifyaddress;
Local PT_WF_NOTIFICATION:Notification &notification;
Local array of string &Emailtextvars;
Local array of string &FileNames;

&notifytemplate = create PT_WF_NOTIFICATION:NotificationTemplate("", "", "AutomatchNotification", "G");
&Notifyto = CreateArrayRept(&notifyaddress, 0);
&notifyaddress = create PT_WF_NOTIFICATION:NotificationAddress("", "", "", "any email address here", "Email");
&Emailtextvars = CreateArrayRept("", 0);
&attachment = "put any path here to an attachment";
&attachment2 = "put any path here to another attachment";
&xmlVars = &notifytemplate.SetupGenericVars(&Emailtextvars);
&notifytemplate.GetAndExpandTemplate(%Language, &xmlVars);
&notification = create PT_WF_NOTIFICATION:Notification("test", %Datetime, %Language);
&notification.NotifyTo = &Notifyto;
&notification.EmailReplyTo = "someone@somewhere.com";
&notification.Subject = &notifytemplate.Subject;
&notification.Message = &notifytemplate.Text;
&FileNames = CreateArrayRept("", 0);
&notification.FileNames = &FileNames;

2. Fire off the Notification event.

3. Review resulting pop up error.

If one attachment is sent the notification works.


Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms