Friday, April 26, 2024

Pega send email notificaiton

 





2.1

String strFileName = tools.getParamValue("OutputFilePath");

PRFile objFile = new PRFile(strFileName); //some error checking

if(objFile.exists())

  objFile.delete();


2.2

call pxGenerateExcelFile

Params - Param.FileName, WEBWB!APPRSVS!XLSX

2.3

String strFileName = tools.getParamValue("OutputFilePath");

PRFile objFile = new PRFile(strFileName); //some error checking

if (!objFile.exists())

{

         attach = false;

} if(!objFile.isFile())

{

         attach = false;

}

tools.putParamValue("OutputLocation",objFile.getName()); if (!objFile.canRead())

{

         attach = false;

    throw new PRRuntimeException("Can't continue with file upload. File \"" + strFileName + "\" is unreadable.");

} //read the file into a buffer.

java.io.DataInputStream dis = null;

byte buffer [] = null;

try

{

    // dis = new java.io.DataInputStream(new java.io.FileInputStream(objFile));    

    dis = new java.io.DataInputStream(new PRInputStream(objFile));

    buffer= new byte[dis.available()];                

    dis.readFully(buffer);

    dis.close();

}

catch (Exception e)

{

    attach = false;

         throw new PRRuntimeException("Can't continue with file upload. Can't read File \"" + strFileName + "\"");            

} //encode the file to Base64 so that we can store it on the database

strFileData = Base64Util.encodeToString(buffer);

if (strFileData == null)

{

         attach = false;

         throw new PRRuntimeException("Can't continue with file upload. Couldn't encode the file to Base64 so that we can store it on the database");            

}

2.5

Page-new att (Embed-EmailAttachment)

2.6

Property-set att

.pyDecode=true

.pyData=local.strFileData

.pyName=Param.FileName


2.7 atts (Data-EmailAttachments)

Page-copy 

from: att

to: atts.pyAttachments(<APPEND>)


Param.AttachmentPage=atts

No comments:

Post a Comment