Hi Community!

 

I need to display existing documents from other sections together with the directly attached documents in FreedomUI 8.1.

 

The attachments are stored in the table "SysFile", which has a column called "TypeId". That lookup has the values "File" (default), "Link" and "Link to object".

 

I have tried to tinker around with the database of my on-premise dev environment. While I could manage to display inserted documents of type "Link", they won't open because the SysFile-table has no columns for referencing other documents.

 

There is also a table called "FileLink", which looks promising because it has the columns "FileSchemaName", "FileRecordId", "RecordSchemaName", "RecordId". That would be enough to link existing documents to various records, but the don't show up in the FreedomUi AttachmentList component.

 

Did anyone already manage to do this without duplicating documents?

 

Any help is much appreciated, thanks!

Robert

Like 2

Like

1 comments

Hi Robert!

 

Unfortunately, displaying the various sections' attachments together in one attachment component is impossible. However, you can use a separate attachment component for each section.

 

To implement this, we recommend the following steps:

1.  Open the Page Designer.

2.  For each section that you would like to display the attachments from:

- add the dropdown field, specifying this section as “Lookup” in the field’s general settings (or make sure that such a dropdown field already exists);

- add the attachment component.

3. In each added attachment component, set “Record to attach files” (general settings) to a value from the previously added dropdown field and “File storage location” (advanced settings) to the corresponding table.

 

After you choose the exact records in the dropdown fields, they will be linked to the current record, and you will see their attachments in the corresponding components. It will help you to avoid duplicating documents.

 

Best regards,

Natalia

Show all comments

Hello community,

 

I want to add data inside a section with the OData interface. I've already checked the documentation at https://documenter.getpostman.com/view/10204500/SztHX5Qb?version=latest and https://academy.creatio.com/docs/developer/integrations_and_api/data_se… but I have the following problem:



I am using a simple Python script to make the API requests in these steps:

 

1. Authenticate in the website using the Authentication method

This works nice using the credentials as payload inside the request.

 

2. Extract the cookie returned inside the header response.

From the test I've made, I need to extract the cookie parts UserName, BPMCSRF, .ASPXAUTH, BPMLOADER and append all of them inside a "Cookie" header like this example:

 

"Cookie: BPMLOADER=; UserType=General; UserName=; .ASPXAUTH=; BPMCSRF=;"

 

Everywhere I've checked inside the documentation it says that it is enough using a header called BPMCSRF with that value from the Set-Cookie response header, but in my case it fails using that value and I have to build the Cookie myself with the different values specified above.

 

3. Perform a POST request to a section like https://mycreatio.com/0/odata/Case

Here the request fails and I get an error 403 - Forbidden with the following message:

 

403 - Forbidden: Access is denied.

You do not have permission to view this directory or page using the credentials that you supplied.

 

And I don't understand why Creatio returns that error, because if I try doing a GET request to the same URL it returns the full list without any problem, but performing a POST request using the same cookie structure inside the headers doesn't return the expected inserted register.

 

Thanks in advance in for your help.

 

Regards.

Like 0

Like

3 comments

Just to clarify, in theory the issue is not related to user permissions as I have tried to insert registers with multiple users (one of them being Supervisor) and in multiple sections, but I always get the same error.

 

P.D. I am using OData 4

Hello Alejandro!

 

For correct requests, you need to use all cookies not "only a part". Also "BPMCSRF" must be used in cookies and as a separate parameter in the header as mentioned in the example here Creatio API (getpostman.com).

Please try and test it with the corresponding changes.

Hello Kyrylo,

 

Thank you very much for your help. In my case the problem was only with that "BPMCSRF" header that I was not building properly, for the cookie values that I have to pass inside the "Cookie" header I tried passing ALL the values extracted from the response header "Set-Cookie" but it didn't let me authenticate, so the solution that works for me is creating a cookie manually with only the values  UserName, UserType, BPMCSRF, .ASPXAUTH, BPMLOADER that I mentioned before.

 

The POST requests are working flawlessly now. I will try now to upload files using OData following the documentation and I would highly appreciate if you are able to help me again if I have trouble.

 

Thank you very much.

Show all comments

Hello community,

 

I want to get the attached files information from a given case inside my environment. As the primary section containing the information is case, I know that I can retrieve the case information from 

 

https://mycreatio.com/0/odata/Case

 

And the attached files can be extracted from 

 

https://mycreatio.com/0/odata/CaseFile

 

Where each element from the response has the format:

{
  "Id": "7bb283a4-2f30-7193-37f3-79c8465ceda4",
  "Name": "<value>",
  "CreatedOn": "<value>",
  "CreatedById": "<value>",
  "ModifiedOn": "<value>",
  "ModifiedById": "<value>",
  "ProcessListeners": 0,
  ...
  "Size": <value>,
  "CaseId": "<value>",
  "IsNeedToNotify": true,
  "SysFileStorageId": "<value>",
  "FileGroupId": "<value>",
  "Tag": "<value>"
},

As you may see there is a field "CaseId" which is used to link the file object to the case object.

 

The problem I have is that I want to get the list of files from a case only by the Case Id. I've tried many different approaches using the OData standard syntax like:

 

'">https://mycreatio.com/0/odata/CaseFile?$filter=CaseId eq '<value>'

 

But I always get an error when trying to access the resource. In the previous example, the error I get is related to the field data type. Creatio yells because the CaseId field is of type Guid but in the comparison I am using a string.

 

By the way, changing the query to:

 

'">https://mycreatio.com/0/odata/CaseFile?$filter=CaseId eq guid'<value>'

 

or

 

'">https://mycreatio.com/0/odata/CaseFile?$filter=CaseId eq <value>

 

Doesn't fix the issue.

 

Can you please help me with this query that I am struggling to do?

 

Regards

Like 0

Like

1 comments
Best reply

Rather than using CaseId, use Case/Id:

https://mycreatio.com/0/odata/CaseFile?$filter=Case/Id eq idvalue

Ryan

Rather than using CaseId, use Case/Id:

https://mycreatio.com/0/odata/CaseFile?$filter=Case/Id eq idvalue

Ryan

Show all comments

Hi everyone,

 

Is there a way to obtain the ID of the selected file in attachments in a Freedom UI section? Looking for an equivalent of activeRow / this.get("SelectedRows") for Freedom UI.

 

Regards,

Ramya

Like 0

Like

3 comments
Best reply

Yes. This is something I would need as well. I've not tried this, but maybe it's possible to add to the rowToolbarItems for the attachments list and get the selected Id from the handler there?

Ryan

Yes. This is something I would need as well. I've not tried this, but maybe it's possible to add to the rowToolbarItems for the attachments list and get the selected Id from the handler there?

Ryan

Ryan Farley,

 

Thanks a lot for the response. This worked!

You can pass the attachment Id in the params as mentioned below:

"rowToolbarItems": [{
	"type": 'crt.MenuItem',
	"caption": 'Get attachment id',
	"icon": 'open-button-icon',
	"clicked": {
		"request": 'psg.MyCustomHandler',
		"params": {
			"Id": "$AttachmentList.AttachmentListDS_Id"
		}
	}
}]

Regards,

Ramya

Ramya R,

Glad to hear this list can also be extended, great news. 

Ryan

Show all comments

I created a business process that starts when an attachment is added to a section (start singnal configured on "record added" to the section attachments).

The business process starts before the end of the file upload then it's not able to read all file content in a script task.

Is there a way to start my business process after the upload has completed?

 

Like 0

Like

2 comments

Hi,

 

You can add a script component in you process and use a Sleep Method (1000 is one second)

System.Threading.Thread.Sleep(1000);

 

Jerome BERGES,

I tried uploading a file of 50MB and it takes 40 seconds to be uploaded:  1 second wouldn't be enough.

The time to wait depends on the speed of the connection and on the file size.

In my test I saw that the file size property increases while the upload proceed, then I used a workaround in my business process: before reading the file a make a loop with a wait of 2 seconds if the current file size is bigger than the one read in the preceding loop. The BP proceed to the file read procedure if the file size doesn't change in 2 seconds. It seems to work but it's really a workaround: is there something more currect and secure to wait for the file to be fully uploaded?

Thanks

Show all comments

Hello community,

 

I have been reading a lot of threads to understand if we can stream files into file detail using postman.

 

According to 

https://community.creatio.com/questions/attachments-and-notes-using-dat…

Odata will not be a viable option



According to 

https://community.creatio.com/questions/fileapiservice-error

FileAPIService cannot be used to pass binary content via postman.



Are we right in understanding that to stream files via API, we need to create a custom service?



Thanks in advance!

Like 0

Like

5 comments

Hi,

You can use FileApiService/UploadFile.

You can find examples in this discussion.

Dmytro Vovchenko,

what is the 

FileApiService?

noyzada,

 

You can find information here.

Bogdan,

Hi,

I'm using the 8.06 version / application section and now all the files save to the SysFile table,

I manage to post a file with postman but I can't connect it to the right record where the details of the files are 

you know how can i do it with the new version? with sysfile table

Show all comments

Hi ,

 

What is the functionality behind the file size update in FileDetailV2. Where is exactly the uploaded file is stored and how can we access the file properties using webservice or esq?

Like 0

Like

1 comments

Hi Anupama,

 

From the client side the chain is as follows: upload method from the FileDetailV2 module then calls the upload method from the ConfigurationFileApi module. This ConfigurationFileApi module upload  method triggers the server side UploadFile method from the FileApiService class that uses the FileRepository class that uses the FileUploader class UploadFile method (that calls the UploadInternal method (with additional validations) and finally uses the Upload method to upload the file). So the upload on the server side is performed using the Upload method from the FileUploader class.

 

To locate the place where the file should be uploaded the FileUploader upload method uses the EntityFileLocator method that uses the fileUploadConfig (that is an object formed from the client-side when the ConfigurationFileApi module upload  method is called). For example if you are loading a file to the Contacts section the object to which the file will be saved is called ContactFile (and it can be also found in the database and configurations).

 

Best regards,

Oscar

Show all comments