We have a requirement for a Service to pass a spreadsheet (Binary Object) into a form upon request. The user should then be able to open it and make changes before sending it back to the service as a Binary Object again... Apologies if this is something that's well documented but I've been through the usual places and can't see much information about complex data coming through a service channel, and also, how is best to allow the user to open and upload a file.Any help or guidance will be appreciated.Cheers, Rich
Hi Garry, I've been asked to look at this 'attachment' upload issue, and I think we may be at cross-purposes a little, so I'll explain what we need to do.
As a starting point, we need a button on a form that will bring up a file browser to allow us to select a spreadsheet, then to send that sheet to a service endpoint. As part of the send, I also need to add some JSON items as well, to tell Provenir what it is I'm asking them to do.
Sounds simple, but it's an unknown for us. Do you have any code samples that would accomplish this?
This is an interesting use case.
From an Avoka perspective, you can programatically create an excel file and attach it to a submission. Use the POI classes provided to do this, I can send an example if you need that.
Regarding getting the attachment to appear at runtime - one possible way is to hijack the prefill service, when the form is loaded use your routines which create the excel attachment, return the binary data then use the attachment service (AttachmentService) to write back to the submission - then save the submission
Then cause a redirectexception to reload the save and the attachment will be presented.
Question : How often is the excel file expected to change - each request, each day etc
If once a day etc, then you could write a scheduled service to write it out as a portal resource then just link to that resource from inside the form (use the Rich text editor for example to point to it)
Let me know if you need actual samples etc