Configuration

Attachments export from the WEBCON BPS database

How to save attachments from the WEBCON BPS form to a hard drive or network share.


This post was inspired by an article found on the web “Export Documents saved as Blob / Binary from SQL Server“. The article shows how to use the T-SQL language to save a file stored in the database on the hard disk. Let’s use this knowledge in our WEBCON BPS environment.

Enabling Ole Automation Procedures

First of all, to enable file export you must enable the “Ole Automation Procedures” option. To do this, run the script below. Note – the option is disabled by default for security reasons. Make sure its inclusion can be done in your company.

Ole Automation Procedures enabling

Procedure for exporting attachments

Below there is a T-SQL script that allows you to export attachments with a specific ID from the WEBCON database. NOTE: In my example, the attachment database is in the WEBCON BPS content database. In your case, attachments may be in the attachment database or another dedicated attachment database. Verify where your files are stored before creating a routine.

NOTE: Remember that the implementation of unauthorized changes on the WEBCON database may result in the loss of the warranty!

Attachments export: WEBCON BPS process configuration

You need to add 2 actions to the transition path:

  • Action that will return IDs of attachments to be exported. In my case, these will be all attachments from the current form.
  • The standard “Run an SQL procedure” action that calls the SQL procedure which is used to save the file on the hard disk based on the SQL query.
Action storing attachments IDs in a form field
Procedure saving attachments as a files in given location

Permissions for the IIS application pool account

The queries executed from WEBCON platform are run executed as IIS Application Pool account. In the procedure above, there are used procedures that are executed on the master database. It is therefore necessary to grant the account permissions to run them on dat database. Below is a script to grant the appropriate permissions. For me it is “ALTERPATHS\SP_WEB” account. In case you do not know which account to enter, see this article for information how to check which account is configured as an IIS application pool account.

How it works

Feature presentation

Export: Limitations of the described solution

  • The files must be saved to a folder that already exists. If you want to create an additional folder – see the article how to make stored procedure to create folders .
  • If there are several files with the same name on the form, the previous file with he same name will be overwritten. If you want files not to be overwritten, you need to add this case handling in the T-SQL script.
nedza.kamil

A graduate of the AGH University of Science and Technology in Krakow. When not involved in the creation and optimization of business processes, he plays board or computer games. He also is interested in using game mechanics (gamification) in real life and business. Spends the evenings creating and prototyping amateur games based on the UNITY engine.

Recent Posts

Managing local WEBCON BPS groups

WEBCON BPS local groups management using simple process. Adding and removal of multiple group users…

3 years ago

Using the FOR EACH ROW form rule in practice

The article describes how to use the FOR EACH ROW form rule in practice on…

3 years ago

Create your own WEBCON BPS Express laboratory from scratch.

A video tutorial on how to set up a WEBON BPS home laboratory from scratch…

3 years ago

JSON nested collection handling in WEBCON BPS

How to use the OPENJSON tabular function to handle a data import to WEBCON BPS…

3 years ago

REST Web Service Connections – WEBCON BPS Authentication

How to configure and use REST Web Service connections using WEBCON BPS Authentication. Examples of…

3 years ago

Upgrade WEBCON BPS Express from 2020 to 2021

How to upgrade standalone version of WEBCON BPS 2020 to 2021. The article describes the…

3 years ago