This example uses forms, End Points and a workflow process to export object data and save it as a CSV file. The file is stored in the platform's File Store and can be downloaded from a link emailed to the user, or picked up from a task in Self Service or User Requests. This idea could be expanded to create a "my downloads" area in My Account.
Quick Start
The zip file in the downloads section includes an End Point group, form group and workflow process model.
- Import and publish the End Points. You'll find them in the formstraining.ajaxpolling namespace. There's no need to make any changes.
- Import "Object Export" workflow. Pick a candidate group eligible to start instances of it. Change the "from" addresses of the mail tasks. Deploy your saved model.
- Import the and publish the "Object Export" form group. Edit the "Request Export Objects to CSV" form. The first drop-down field on Page 1 holds the name of the object type to export. Change this to a known type you want to export, or modify the example custom query in the guidance text field and add it to the "Grouped Options" property.
Once everything's imported, add the "Request Export Objects to CSV" form to an article and fill it out. If you have User Requests or Self service, you could set them up to display instances of the Object Export workflow.
Start Form
The start form in this process lets a user pick the object type to export, then choose which properties will be added to the CSV. When submitted the form starts a workflow process instance.
Workflow
The workflow process serves two purposes. First it calls an End Point which starts the export, then waits at a message catching event. When the End Points have completed the export they update the workflow with the details of the file and send a message which pushes the execution on to the email and user tasks.
The user task is automatically assigned to the user who started the instance. A timer is attached to it which will end the task and instance after five minutes (this could be extended).
When the process instance ends the export file is automatically deleted from the File Store. This is a standard feature of workflow. When an instance ends a delete call is made, and as the workflow has the only reference to the file (the process doesn't store any file references in history for example), the file will be removed.
End Points
The End Points use the Asynchronous End Point Framework. The downloads on this page include the full framework - if you already have the framework you can just import the "Object Export" End Point group.
ObjectExportWorkflow is responsible for creating the CSV file, exporting the chosen objects in batches, pushing the export file into the File Store, updating the process instance variables with details of the file, then messaging the instance to release it from the event activity.
Download Form
The download form is used by the single user activity in the process model. You could link to this task in Self Service or, as in the example form related to this page, send a link to the task via email.