Posted: 4 Oct 2016 6:13 EDT Last activity: 18 Jul 2017 5:27 EDT
How to automatically attach a file to a work object?
In our 7.1.8 application there is a point in a flow where we want to automatically attach a file from a network or local drive. I've looked at the Smart Shape "Attach Content" but it only allows attaching a binary file, and even then we can't specify an external file, only one that has already been uploaded, so I'm not sure what possible use it could be. The help isn't particularly helpful either as it is very different to the actual shape.
Is there an OOTB activity/function/flow action that can take a filename parameter and attach the file to a work object? Or is it a case that we have to manually create an attachment page and set the value of pxAttachName to be the path of the attachment? And even if we do that, what else do we need to do to get the data to actually upload?will the "SaveAllAttachments" activity do that?
And can someone at Pega tell us if they will ever update the help to include this information? I have not been able to find anything in the PRPC help that covers any aspect of automatic file attaching (outside of report PDFs).
This fetches a file an 'external' URL converts it into a Binary Array and then attaches to PRPC - I only tested it with PDF files - but it should work (or at least a very similar Activity could be built) for other filetypes as well...
So I was thinking about this question again - you need to attach a file to a work item during a flow - and I presume the OOTB mechanism - to add attachments (via an upload etc) on the standard Portals are not sufficient here ?
Or do you mean to attach a file without user-interaction here ? (You said 'automatically' in your description - is this what you mean?).
It's the latter - I'm looking to attach a file without user interaction.
A little background:
Users will process work items of type A in the usual manner. Every 30 seconds or so an agent will run and count the number of these work items that have reached a certain state. Once this count reaches 50 a job will run to produce a CSV file containing a summary of these 50 cases in a format suitable for a specific external system. A work object of type B will also be created and the CSV file attached to the work object, and the count reset back to zero. Users will be able to open work object B, download the CSV file locally and process them on the external system. This will occur several times each day. Obviously there will be a little more to it that that but that's the gist.
Thank you for your assistance. As a workaround I have found the following is giving me the functionality I require:
1. The contents of the new CSV file are written to a single property.
2. A new Data-WorkAttach-File page is created.
3. The property is encoded to Base64 and moved to the attachment page's pyAttachStream property.
4. The new attachment is saved and linked to the work object.
However, as a more practical solution I will be implementing an external table with the CSV data stored in rows that can be retrieved via a report definition and exported to Excel for a better user experience. Neither of these is ideal, but in the absence of proper automatic attachment fuctionality it will suffice.