How do I get the link to an attachment file using system actions? If I hover over the link to the file in the attachment detail of the record, I get something like https:///0/rest/FileService/GetFile/.  The GUID doesn't match the attachment record ID. How do I get the link or ID of the file from the attachment record to send the link to someone else?

Like 0

Like

8 comments

To achieve your target you need to create a link that is a sum of:

https://<instance>/0/rest/FileService/GetFile/

+

UID value from SysSchema table for the detail from which you try to get file from: OrderFile, InvoiceFile, AccountFile etc

+

ID value from the table which represents this detail.

For example I have a record in OrderFile table (order attachment) with an ID: 2AC7AA00-2E61-4AEC-8BD0-621269731DAA. To complete the link I execute:

SELECT UID FROM SysSchema WHERE Name = 'OrderFile'

and get a value of D75D815B-0B2E-4E33-973A-ED9A43601B44. So my link is:

https://<instance>/0/rest/FileService/GetFile/D75D815B-0B2E-4E33-973A-ED9A43601B44/2AC7AA00-2E61-4AEC-8BD0-621269731DAA

Please note that user that doesn't have active session in https://<instance> won't be able to download the file.

Oscar Dylan,

How do I set the system actions to that I have a process like this:

Janine White,

It is impossible to do using the process on the screenshot. You need to add an auto-generated page where you can specify file name and schema name, after that this process should read this file and schema parameters (there should be several conditional flows for different schema names). Also you need to create a lookup with all schema names so to be able to choose from lookup in this auto-generated page from the first step. Then there should be "Read data" element that reads "Schema" object so to get UID of the schema specified on the auto-generated page that we've added previously. After that the formula element should create a link for the string parameter (using the logic I've described previously) that will be used in the final auto-generated page element where this string parameter value will be placed. Feel free to use our official documentation on business process design to achieve your business task.

Oscar Dylan,

I can read the file name from the attachment record, which is available in a parameter, and I know the attachment section, "bpm'online Environments attachments".  Why would I need to select anything manually?  I know how to set up business processes in general and use Read data elements as I've done that hundreds of times. I just don't understand how to identify the Schema and UID from the attachment record from the instructions above.  When I use the following read data, the UID is returned as zeros, clearly missing. The link in the process ends up being, "https://dev-katerra.bpmonline.com/0/rest/FileService/GetFile/00000000-0…" where "abe00c37-67f4-413c-93a0-1fa4af899bdc" is the Id of the attachment.

Nevermind, I figured out that the UID is in the link for existing files, so, I don't need to look it up.  I'll just copy it from there.

Oscar Dylan,

 There is a way to preview the file in the browser if there is a image? What format is returning the method to the client?

 

this  works to show the attachment in the browser.

var endpoint = "https://"+window.location.hostname+"/0/rest/FileService/GetFile/7661a363-68f6-4c26-879c-0590c22b963a/" + responseCollection.collection.items[0].$Id;
 
 
 
fetch(endpoint)
  //                         vvvv
  .then(response =&gt; response.blob())
  .then(imageBlob =&gt; {
      // Then create a local URL for that image and print it 
      const imageObjectURL = URL.createObjectURL(imageBlob);
      console.log(imageObjectURL);
  });

 

Racheli Gins,

 

It's because these UIds are not stored in the module structure:

If you need this logic to work in classic UI you need to hardcode the values as constants in your code.

Show all comments

I would like to have an option to specify that an attachment detail is read only in the properties. For example, I use multiple attachments sections for answering questions where one is reference information that should not be changed by the person answering the question and the other is for adding attachments in response to the question. This feature would significantly simplify using attachments. We have several sections that would use this functionality.

1 comments

Dear Janine,

You can set up the access permissions for the detail attachment object. The user will be able download the file, but not able to upload the edited one. Here is the example with the account attachment detail http://prntscr.com/oywufb

Once the user tries to upload the new edited file, the system will display the error message. 

Best regards,

Dean

Show all comments

Is there an object that can be used to trigger start a process when a new attachment is added on the attachments tab of a record?

For certain sections, it would be nice to receive an email notification when a new attachment is added.

Like 0

Like

1 comments

Dear Mitch,

You can use "SectionName attachment" objects to trigger such process, for example "Contact attachment" object. 

Best regards,

Angela

Show all comments



Hi there,

Can someone please let me where in the CRM are all the attachments stored in the database?

So say if I attach a file in the Attachment and Notes tab in the Contacts section, I know that the Attachments detail is called Contact's Detail but which object holds those attachments in the database?

Thanks,

AK

Like 0

Like

8 comments

Hello,

All files are stored as binary data in the "data" column of the object. Each one is stored in their own column, for example 'ActivityFile'

Best regards,

Angela

Angela Reyes,

 

Is it possible to copy the attachments from one object to another by copying the binary data from "data" column of the object.

 

Regards

Sivanesan

Hi,

If the field "Data" contains a correct value and not something like "0x" then yes, you can take this data and add it to another object.

For example, you can do it inside a business process script task.

 

var fileName = file.GetTypedColumnValue&lt;string&gt;("Name");
            var fileType = file.GetTypedColumnValue&lt;Guid&gt;("TypeId");
            var fileData = file.GetBytesValue("Data");
 
            var fileEntity = new ActivityFile(userConnection);
            fileEntity.SetDefColumnValues();
            fileEntity.SetColumnValue("ActivityId", activity.Id);
            fileEntity.SetColumnValue("TypeId", fileType);
            fileEntity.SetColumnValue("Name", fileName);
            fileEntity.SetColumnValue("Data", fileData);
            fileEntity.Save();

 

Dmytro Vovchenko,

 

Thanks for the response Dmytro. I am trying to copy the attachments from section A to section B. I have used "Add Data" element inside a BP to copy the data from A to B. The BP runs without any issue but when I try to open the same attachment from section B its throwing below error.

When I queried the object the attachments(both the sections) , it just shows the data type(System.Byte[]).

 

Can you please show how exactly you copy data in your bp?

Dmytro Vovchenko,

PFB

 

 

It looks like you cannot use "Add record" and "Read record" in this case because they cannot work with the "Data" type. You really need to use a script-task to read and add file:

        var ESQ = new EntitySchemaQuery(manager, AccountFile);
	    ESQ .AddColumn("Name");
	    ESQ .AddColumn("Data");
	    ESQ .AddColumn("Type");
 
	    var dataQueryResult = ESQ.GetEntityCollection(userConnection);
	    foreach(Entity file in dataQueryResult) {
		    var fileName = file.GetTypedColumnValue&lt;string&gt;("Name");
		    var fileType = file.GetTypedColumnValue&lt;Guid&gt;("TypeId");
		    var fileData = file.GetBytesValue("Data");
 
			var fileEntity = new ContactFile(userConnection);
		    fileEntity.SetDefColumnValues();
		    fileEntity.SetColumnValue("CintactId", contact.Id);
		    fileEntity.SetColumnValue("TypeId", fileType);
		    fileEntity.SetColumnValue("Name", fileName);
		    fileEntity.SetColumnValue("Data", fileData);
		    fileEntity.Save();
	    }

 

Dmytro Vovchenko,

 

I was able achieve it using the "Add data" itself. I missed to update/add the attachment type. After I added it I am able to open the attachment. Thanks for your input.

Show all comments

How do I use the Add data System action to add a link in the Attachments of a section?

For example, I tried to add a link to an object being approved in the Katerra Approvals section to the Attachments of the Katerra Approvals record with the following setting and the link attachment was not created.

 

Like 0

Like

1 comments

Dear Janine,

Please change the type to "Link": [#Lookup.Attachment Type.Link#].

This will solve the issue.

Regards,

Anastasia

Show all comments

bpm'online community,

How to create a custom editing page for details Files?

I need to change the value of custom lookup depending on the type of document.

 

I've already added all the necessary fields to the object "UsrProjetsFile".

I don't know which scheme to change to insert the fields into the editing page, which is opened by double-clicking on the details record File.

Could you please help with this issue.

Thanks!

Like 0

Like

2 comments

Hi Mariia,

 

Did you figure out on how to change this?

I am looking for the solution as well.

 

Thank you in advance!

 

 

Kind regards,

Yosef

Hello Yosef,

 

Yes, we have found a solution. It was simple for our case.



Firstly, you need to add the necessary column to the [Section]File object, where [Section] is the name of your section in which the detail files are placed (In my example the column with type lookup names "Nature").

Then you create a "Replacing Client Module" where the parent schema is LinkPageV2 ( UIv2 ).

And then you create your column in the diff part:

define("LinkPageV2", ["terrasoft", "BusinessRuleModule", "ext-base", "sandbox", "ConfigurationConstants"],
function(Terrasoft, BusinessRuleModule, Ext, sandbox, ConfigurationConstants) {
	return {
		methods: {},
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"parentName": "LinkPageGeneralBlock",
				"propertyName": "items",
				"name": "Nature",
				"values": {
					"bindTo": "Nature",
					"layout": {
						"column": 12,
						"row": 0,
						"colSpan": 12
					}
				}
			},
		]/**SCHEMA_DIFF*/
	};
});

That's it)

 

Best regards,

Mariia

 

Show all comments

I want to show in Cases section, in a detail, all email attachments that are associated the case.

For this I have done the following steps:

1-Created a database view that get all email attachments that are associated to a cases.

2-Create the object in the /0/dev console. 

3-Create a detail with the detail wizard.

4-Chage base object of the detail as said in:

https://academy.bpmonline.com/documents/technic-sdk/7-13/adding-attachm…

After all this done, the detail is being shown but it doesn't show any record, and it throws some errors in the browser console:

Are the steps I have done correct?

What could be causing this error? 

Regards, 

 

Javier

 

Like 0

Like

1 comments

Please make sure that the object was published. Additionally please make sure that there is a view in the database named http://prntscr.com/mydb2y

Show all comments

When creating a case automatically from an email, is there a way to configure it to add the attachment of the email as an attachment of the case?

Regards.

Like 0

Like

2 comments

Javier,



you can see my sample, how we add email attachment to the lead attachment.

So, you can created process on 'case is created' and add attachements from received email to the Case

Thank you!

Show all comments

Hello community,

my client is aiming to change the default document storage for attachments on every objects (Accounts, Contacts, Leads, Opportunities, Products, and Invoices) to Azure environment. 

They already have SSO for that Azure environment.

How could we handle this?

Thanks,

Like 0

Like

1 comments

Dear Danilo,

As for now there is no such functionality, unfortunately. As a workaround you may use the following application: https://marketplace.bpmonline.com/app/external-file-storage-bpmonline

Show all comments

Hello,

Im trying to lock an attachment from being downloaded from the knowledge center. Is this possible in some way? I would need a full lock, nobody except Supervisors could download them

Thank you for your time

Like 0

Like

1 comments

Dear Pablo,

Such task can only be achieved by the means of development in the system.

In the Configuration add a replacing schema of FileDetailV2.

In the schema, you need to:

1. Initialize check of the current user, whether he has system administrator role. This is an ESQ method called in init function.

2. Set the result of ESQ to an attribute, so to use it later in the method check.

3. Override basic addColumnLink method and add two checks: section check and system administrator check.

The example of replacing FileDetailV2 schema is displayed below:

define("FileDetailV2", ["ConfigurationConstants"], function(ConfigurationConstants) {
	return {
 
		attributes: {
			"isSysAdmin": {
				"type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
				"dataValueType": Terrasoft.DataValueType.BOOLEAN,
				"value": false
			}
		},
 
		methods: {
			init: function() {
				this.getUserRights();
				this.callParent(arguments);
			},
			addColumnLink: function(item, column) {
				if (this.parentEntity.EntityName === "KnowledgeBase") {
					if (this.get("isSysAdmin")) {
						this.callParent(arguments);
					}
				} else {
					this.callParent(arguments);
				}
			},
			getUserRights: function() {
				var scope = this;
 
				var currentUser = Terrasoft.SysValue.CURRENT_USER.value;
				var sysAdmins = ConfigurationConstants.SysAdminUnit.Id.SysAdministrators;
				var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "SysUserInRole" });
				esq.addColumn("SysRole");
				esq.addColumn("SysUser");
				esq.filters.add("SysUser", Terrasoft.createColumnFilterWithParameter(
					Terrasoft.ComparisonType.EQUAL, "SysUser", currentUser));
				esq.filters.add("SysRole", Terrasoft.createColumnFilterWithParameter(
					Terrasoft.ComparisonType.EQUAL, "SysRole", sysAdmins));
				esq.getEntityCollection(function(response) {
					if (response &amp;&amp; response.success) {
						var result = response.collection;
						var isSysAdmin = (result.collection.length !== 0);
						scope.set("isSysAdmin", isSysAdmin);
					}
				}, this);
			}
		}
	};
});

Regards,

Anastasia

Show all comments