addattachment peoplecode

addattachment peoplecode

addattachment peoplecode example

AddAttachment :  You can use the this function to upload one file from an end user machine to a specified storage location. To upload more than one file with a single function call, use the MAddAttachment function.

Syntax of AddAttachment:

AddAttachment(URLDestination, DirAndFilePrefix, FileType, UserFileName[, MaxSize [, PreserveCase[, UploadPageTitle[, AllowLargeChunks]]]])

&retcode = AddAttachment(“record://PSFILE_ATTDET”, ATTACHSYSFILENAME, “”, ATTACHUSERFILE, 0);

If you can upload more find then using peoplecode function “MAddAttachment”

 

Syntax of MAddAttachment:

MAddAttachment(URLDestination, DirAndFilePrefix, Prompts, &UserFileArray, &ActualSizeArray, &DetailedReturnCodeArrayName [, MaxSize [, PreserveCase[, UploadPageTitle[, AllowLargeChunks[, StopOnError]]]]])

Example
&retcode = MAddAttachment(URL.MYFTP, ATTACHSYSFILENAME, 4, &MyFileArray, &MySzArray, &MyRtrnCodeArray, 0, False, “Upload Attachments”, False, True);
The following example demonstrates initialization of the arrays used to store the values returned by MAddAttachment:

&prompts = 2;
Local array of string &AttachUsrFiles;
&AttachUsrFiles = CreateArrayRept(“”, 0);

Local array of number &AttachSzs;
&AttachSzs = CreateArrayRept(0, 0);

Local array of number &AttachRtrnCds;
&AttachRtrnCds = CreateArrayRept(0, 0);

If Exact(Left(&URL_ID, 4), “URL.”) Then
&sum_rt_cd = MAddAttachment(@(&URL_ID), ATTACHSYSFILENAME, &prompts, &AttachUsrFiles, &AttachSzs, &AttachRtrnCds);
Else
&sum_rt_cd = MAddAttachment(&URL_ID, ATTACHSYSFILENAME, &prompts, &AttachUsrFiles, &AttachSzs, &AttachRtrnCds);
End-If;

 

 

Reference:https://docs.oracle.com/cd/E25688_01/pt852pbr0/eng/psbooks/tpcl/chapter.htm?File=tpcl/htm/tpcl02.htm%2348df64020f1b7a4_5c62bc_1229ed4fbbe__7483

Reference:https://docs.oracle.com/cd/E80738_01/pt854pbh2/eng/pt/tpcl/langref_PeopleCodeBuilt-inFunctionsAndLanguageConstructs_M.html#topofpage

Posted in Peoplecode, PeopleSoft.