Hello. I need to create a QuickFilter on a Freedom UI Page whose value will change dynamically. I found a post https://customerfx.com/article/using-custom-attributes-on-a-creatio-fre… so I try to use the attribute but it does not work. Could you help me please?

{
    "filterType": 1,
    "comparisonType": 3,
    "isEnabled": true,
    "trimDateTimeParameterToDate": false,
    "leftExpression": {
        "expressionType": 0,
        "columnPath": "MyColumn"
    },
    "isAggregative": false,
    "dataValueType": 1,
    "rightExpression": {
        "expressionType": 2,
        "parameter": {
            "dataValueType": 1,
            "value": "$MyAttribute"
        }
    }
}
Like 0

Like

1 comments

Hello,
It seems that the attributes will not work properly with the filter, as an alternative I can suggest applying the full filter in a handler where you can change it as you want, for example:

		handlers: /**SCHEMA_HANDLERS*/[
          {
            request: "crt.HandleViewModelAttributeChangeRequest",
            handler: async (request, next) => {
            	const result = await next?.handle(request);
            	request.$context.DataGrid_7cyakqc_PredefinedFilter={"items": {
								"1893734f-7c93-40a5-9592-8e7231005e10": {
									"filterType": 1,
									"comparisonType": 7,
									"isEnabled": true,
									"trimDateTimeParameterToDate": false,
									"leftExpression": {
										"expressionType": 0,
										"columnPath": "Age"
									},
									"isAggregative": false,
									"dataValueType": 4,
									"rightExpression": {
										"expressionType": 2,
										"parameter": {
											"dataValueType": 4,
											"value": 20
										}
									}
								}
							},
							"logicalOperation": 0,
							"isEnabled": true,
							"filterType": 6,
							"rootSchemaName": "Contact"};
            	return result;
              }
          }
        ]
Show all comments

Hi,

 

Is it possible to set a title for a column in a DataGrid dynamically via client code?

 

I tried the following steps:

  1. Add an attribute to viewModelConfigDiff called "InspectorsSundayCaption".

 

            viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
            {
                "operation": "merge",
                "path": [
                    "attributes"
                ],
                "values": {
                   "InspectorsSundayCaption":{
                   },

            ......}

 

  2. Bind the attribute to the caption property of column

                       {
                            "id": "aaa335c2-8291-0f65-e930-e39ca7e333a7",
                            "code": "DataGrid_244wb6vDS_UsrwpPoliceCarsSunday",
                            "path": "UsrwpPoliceCarsSunday",
                            "caption":"$InspectorsSundayCaption2",
                            "dataValueType": 4
                        },

 

  3. Set the attribute in the HandleViewModelInitRequest handler with the specific value.

 

    {
                request: "crt.HandleViewModelInitRequest",
                  handler: async (request, next) => {

                           .....

                           request.$context.InspectorsSundayCaption = "Sunday inspectors " + sundayDateStr;

                           await next?.handle(request);

}

 

This way work to me in normal column caption, But it doesn't work in a DataGrid column

 

Is there any limitation/step I'm missing?

 

Thanks in advance for your assistance!
Rachel
 

 

Like 0

Like

2 comments

Hi,
Does anyone have an idea?

Hello Rachel Markovski,

I have contacted our R&D team in order to help find a solution for your problem. The answer is unfortunate - currently there is no mechanism to dynamically change column caption in the datagrid component. 

Hope this helps.

Show all comments

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