cancel
Showing results for 
Search instead for 
Did you mean: 

Read Attachment File name of SFTP Adapter

manikandan_shanmugam3
Active Participant
0 Kudos

Hi All,


I have a requirement that SFTP adapter will pick two files ( One as a Main payload and other one as attachment through additional Files option)


Requirement:  I need to read the attachment file name and send it via field.


Kindly help with the UDF code for the same.


Note : We are using PI7.31


Regards,

Mani

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

try the following code in the UDF

GlobalContainer globalContainer = container.getGlobalContainer();

InputAttachments inputAttachments = globalContainer.getInputAttachments();

String attachmentID = null;

try

{  

if(inputAttachments.areAttachmentsAvailable())  
{

Collection<String> CollectionIDs = inputAttachments.getAllContentIds(true);  
Object[] arrayObj = CollectionIDs.toArray();

for(int i =0;i<arrayObj.length;i++)  

{

  attachmentID =(String)arrayObj[i];   // this should return the file name
}

}

catch (Exception e)  

{
   e.printStackTrace();  

}