Hello,

 

I have a web service that generates a file. I need to attach that file to a record. I see there is an option to the Process File Component passing a File as parameter, but the Parameter is Expecting a IFileLocator. How can I use a script to create a IFileLocator from a full file path on Creatio Studio version 8.1? 

 

Thanks,

Jose

File attachments
Like 0

Like

2 comments
Best reply

Hello,

You should use a script task to work with files from the web service.

 

More details about the API file:



https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…

Hello,

You should use a script task to work with files from the web service.

 

More details about the API file:



https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…

Thanks Cherednichenko. Using the information provided I wrote the C# below to attach a generated file to a record.



public void AttachFile(string schemaName, Guid recordId, string fullFilePath) {

            /* Create a unique ID for the new file. */

            Guid fileId = Guid.NewGuid(); 

            /* Create a file locator for the new file. */

            var fileLocator= new EntityFileLocator("SysFile", fileId); 

            /* Get an IFile object for the new file. */ 

            IFile file = UserConnection.CreateFile(fileLocator); 

            /* There is no file metadata or file content in the available file storages. Specify the file name in the file metadata. */

            file.Name = (new System.IO.FileInfo(fullFilePath)).Name; 

            /* Set an attributes for the new file: */

            file.SetAttribute("RecordSchemaName", schemaName); 

            file.SetAttribute("RecordId", recordId);             

            /* Save the file metadata Do this BEFORE saving the content. */

            file.Save(); 

            using (var sourceStream = new FileStream( fullFilePath, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize: 4096, useAsync: true)) {

                file.Write(sourceStream, FileWriteOptions.SinglePart);            

            }

        }

Show all comments

Hello,



For a new app on version 8.1, I'm trying to lock up all fields on a page based on the record condition. I have a Locked by field on the record and if the field is empty or different than the current user, I want to make the whole page read only. 



I was able to do that on previous versions by adding some code to the page. At high level I needed to add the  IsModelItemsEnabled attribute and have a "setCardLockoutStatus" method that triggers when the UsrLockedBy field changes. I also need to do a merge operation on the CardContentWrapper to set the generator value to DisableControlsGenerator.generatePartial.



What page code I need to write to accomplish something similar on 8.1? Or can that be accomplished now with no code?



Thanks,

Jose

Like 4

Like

4 comments
Best reply

Hello Jose,

 

The way of locking the whole page you've described is based on using the "CompleteCardLockout" feature. Unfortunately, it is not available to use on the Freedom UI pages. 

However, you may implement it using Page Designer business rules. It is possible to specify a rule that makes all the input fields editable/read-only based on the field value condition, for example:

 

The same approach might be implemented via code using the “readonly” attribute. Here is the example: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/platform-customization/freedom-ui/customize-page-fields/examples/set-up-the-condition-that-locks-the-field#title-3819-2. You may create one common attribute that will be responsible for locking the fields, though in that case, you should manually add its name to the "readonly" value of every field.

 

Also, you may consider using record permissions instead of the "Locked by" field. This type of permission is based on the record authorship, here are the details: https://academy.creatio.com/docs/8.x/setup-and-administration/administration/user-and-access-management/access-management/record-permissions.

 

Best regards,

Natalia

Hello Jose,

 

The way of locking the whole page you've described is based on using the "CompleteCardLockout" feature. Unfortunately, it is not available to use on the Freedom UI pages. 

However, you may implement it using Page Designer business rules. It is possible to specify a rule that makes all the input fields editable/read-only based on the field value condition, for example:

 

The same approach might be implemented via code using the “readonly” attribute. Here is the example: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/platform-customization/freedom-ui/customize-page-fields/examples/set-up-the-condition-that-locks-the-field#title-3819-2. You may create one common attribute that will be responsible for locking the fields, though in that case, you should manually add its name to the "readonly" value of every field.

 

Also, you may consider using record permissions instead of the "Locked by" field. This type of permission is based on the record authorship, here are the details: https://academy.creatio.com/docs/8.x/setup-and-administration/administration/user-and-access-management/access-management/record-permissions.

 

Best regards,

Natalia

Natalia Kalynovska,

Thanks Natalia. I do have a lot of fields on the page so I was looking for something like the CompleteCardLockout feature, but business rule will do. Do you know if there are any plans to have that feature on the freedom UI version? It takes some maintenance to keep those rules updated every time fields are added to the page.

Jose Hernandez,

 

We registered such a request for our R&D department, and they will consider implementing this feature for the Freedom UI pages.

Thank you for helping us to make our product better!

Natalia Kalynovska,

This feature would be very useful, definitely miss having that option that we had in Classic UI.

Show all comments

I would like a button that I placed on a page to perform a custom action (something outside of the options in the button's dropdown menu). 

 

Can anyone point me in the direction of documentation or an academy page that explains how to do this?

 

Thanks!

Like 0

Like

4 comments
Best reply

Hello,

I have an article that outlines how to execute custom code from a button on a Freedom UI page here: https://customerfx.com/article/adding-a-button-to-execute-custom-code-o…

Ryan

Hello,

I have an article that outlines how to execute custom code from a button on a Freedom UI page here: https://customerfx.com/article/adding-a-button-to-execute-custom-code-o…

Ryan

Ryan Farley,

Thanks for the article, this worked for me. So I will need be comfortable with Ext.js and Terrasoft to do more advanced customizations? 

Joe Brunet,

In Creatio there are two types of pages. Classic pages and Freedom UI pages. Freedom UI pages are the newer types, the application is slowly getting converted to Freedom UI (Classic pages are now considered legacy, the future of the application is Freedom UI).

Classic pages are based on Extjs, although you don't really need much, or any, Extjs knowledge. That's really just the framework that the pages themselves use. When you add code on the page, you don't really need to use any Extjs functionality. For Freedom UI pages things are different. The article I mentioned is for how to do this on a Freedom UI page. These pages are based on Angular, although you don't really need any Angular knowledge unless you are creating new components/remote modules. The Terrasoft usage is mainly for working in Classic UI pages, much of the functionality there is being replaced by the new Creatio DevKit SDK. The Terrasoft library is one created by Creatio (the company name used to be Terrasoft).

However, in either case, all the page code is using Javascript, so knowing Javascript is helpful. I do find, however, that using Freedom UI pages there is less and less need to add page code (Javascript) to do many types of customizations which required page code in Classic pages.

Ryan

Ryan Farley,

 

Thank you for that explanation; it was incredibly helpful! 

Show all comments