Question

Download Attachments by clicking on Link Control

Hello

I have a list (table) of open cases in which there is an attached file. I need to display a link to download the internal case file to the table of open cases.

1 How are files downloaded?
2 How to do this by clicking on Link Control?

Comments

Keep up to date on this post and subscribe to comments

October 4, 2018 - 10:24am

Hello

 

Have a look at the implementation done in below link:

https://community1.pega.com/community/pega-support/question/download-document-click-link

Hope it helps

Regards

Bhavya

October 4, 2018 - 10:52am
Response to Bhavya_Incessant

thanks for your reply

According to the link offered by you, if I understood correctly, they act inside the case, but I need to make a link to download outside the case

October 4, 2018 - 10:26am

If I try using pega.ui.HarnessActions.doAttachmentSingleClick, I don’t know what parameters to pass, because I do not have all the data about the attached file outside the case, from where I need to download it

October 4, 2018 - 11:14am
Response to RazdinM9840

Hi

By "outside the case" you mean , that you are hitting some other database to retrieve the document ? Or is it something else?

 

Regards

Bhavya

 

October 5, 2018 - 9:00am
Response to Bhavya_Incessant

Hello
I mean that in case “B” I have attached file and I try to open it from case “A” (parent case) by clicking on Link.
"A" - parent case
     "B" - child case

October 5, 2018 - 2:04am

can you try using Call view ?

March 29, 2019 - 3:50am

On link call one activity, Create a page called AttachPage and set following properties 

>pxAttachName (file name with extension)

>pyAttachStream(binary file)

Add one more step and use JAVA method , put below code

try{
  
  ClipboardPage AttachPage=tools.getStepPage();
  String sFileName = AttachPage.getString("pxAttachName");
  String sMsg = tools.sendFile(AttachPage,"pyAttachStream",true,null,sFileName,false,null,true);
  if(!sMsg.equals(""))
  {
  pega.terminateActivity();
  }
}
catch(Exception e){
  oLog.error("Download attachment error: "+e);
}

 Note: For some file extension such as txt or xml etc, highlighted underlined boolean value set to false for SendFile public API.