Obtain the physical path of Bizagi uploads

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Business Rules examples > Documents and files > File management with expressions >

Obtain the physical path of Bizagi uploads


This article describes how to calculate the physical path of uploads in Bizagi.

Recall that uploads in Bizagi are those documents or other types of files, which have been attached to a specific case, either via the user interface or by means of Bizagi's API (e.g, SOAP web services, business rules).

Specifically, they consider all files that reside on attributes of the type file or image, in your Bizagi process model.

For more information about file or image attributes refer to Attribute types.



This information is not applicable to Automation Service.

Recall that with Automation Service, a team of experts is appointed in Bizagi, taking care of all infrastructure and services, and its related IT tasks involving provisioning, maintenance and tuning, or technical support. This includes having all infrastructure and services being monitored 24x7.

This entails that you may not access directly storage paths, or use any other similar treatment based on physical location of files.

You should work with information of uploads through Bizagi Connectors or within business expressions.


When is this useful?

Regularly, you will not need to worry about the exact physical location of uploads in Bizagi.

Bizagi manages uploads consistently across its different components, including its user interfaces, when either saving them or when viewing them afterward.

However, there may be situations in which will want to process (read or update) information contained inside of an uploaded file.

When this is the case, you may locate the file in its physical path and use business rules (i.e, component library features) to manipulate the file and its contents.



This approach works if you are storing files in a file server (excludes ECM integration when you use a SharePoint, Alfresco, or similar repository).


It also applies when that file has been already persisted physically by Bizagi.

This means that when a file is uploaded for the first time, within that same task you may not access it physically because it currently resides within the scope of that task.

The file will be located in such physical path after the transaction has been committed.

For more information about Bizagi scopes, refer to Scopes.


Physical path formula

The following formula refers to the dynamical sub-folder structure contained inside of the Upload Path parameter of your project, which is configured as described at Advanced Environment Configuration.

The sub-folder structure is organized as described below:



Recall that by default, the base path as represented by %BA_DEFAULT_UPLOADPATH%, is located at C:\Bizagi\Projects\[Your_Project]\Docs\.

For this formula, consider:


IdEntity: It is the Id of the entity, to which the file type attribute belongs to. This is dynamic information, therefore you can know this information in runtime. To obtain the value, we recommend you use this expression:




SurrogateKey: It is the value of the key of this entity's instance, where the file type attribute is. In order to know the key value of the entity's instance, you may need to obtain the desired entity and checkout its .SurrogateKeyValue.

This is dynamic information, therefore you can know this information in runtime, as each process' case will have a different SurrogateKey.


WholePart: It is defined as the whole number of the dividing the SurrogateKeyValue by 1000; or can be obtained with the following calculation:

  WholePart = (SurrogateKey - (SurrogateKey Module 1000)) / 1000

  Again, this is dynamic information as it is derived from the SurrogateKeyValue.


IdAttribute: It is the id of the attribute of file type that currently stores the uploaded file. This is dynamic information, therefore you can know this information in runtime with the following expression:





We strongly suggest you use CEntityManager.GetEntity("EntityName") instead of Me.getXPath("entity-list('EntityName','Filter')",parameters) to make sure your expression works correctly.



A file was uploaded in an entity called Products (id number 10043 obtained with the rule CEntityManager.GetEntity("Products").Id).

The file type attribute in Products which stores this file is called Document (id number 10010 obtained with the rule CEntityManager.GetEntity("Products").Attributes["Document"].Id).

Therefore, for this example, the physical path is calculated as follows:


IdEntity: 10043.

IdAttribute: 10010.

SurrogateKey: 205 (obtained from the created case)

Whole part: 0 (Whole part = (205 - 205) / 1000)


Assuming the upload path is configured in Bizagi Studio for this project as: C:\BizAgi\Projects\Project01\Docs\.

Then the whole path to access this file would be: C:\BizAgi\Projects\Project01\Docs\10043\0\205\10010\.


If your uploaded file is called OctoberBalances.xls, then your file is available as C:\BizAgi\Projects\Project01\Docs\10043\0\205\10010\OctoberBalances.xls.



In order to obtain the fileName of your uploaded file dynamically, use the getXPath similarly to the way described at Uploading Files using expressions.