I tried returning false and not calling next?.handle(request), but the record still seems to get saved. In Classic UI it was possible to prevent saving by not calling the this.callParent method, which I believe is somewhat analogous to the next?.handle(request), but I guess not perfectly? Maybe I'm missing something.

Like 1

Like

1 comments
Best reply

Hello Harvey,

It is possible, and you do it in the right way as I can see from the description. To prevent saving you have to declare this handler in the scheme and simply do not call next?.handle(request). 

Hello Harvey,

It is possible, and you do it in the right way as I can see from the description. To prevent saving you have to declare this handler in the scheme and simply do not call next?.handle(request). 

Show all comments

Hi

Tell me how you can sort the registry by field, the field can be either integer or lookup.

I tried it in the viewModelConfig block

indicate

"attributes": {
"ItemsSorting": {
{
"direction": "asc",
"columnName": "MscPriorityInteger"
}
}



but there is no effect, what am I doing wrong? How to correctly formulate conditions for sorting.

Thank you

Like 0

Like

3 comments
Best reply

Шевчук Святослав,

 

this can be checked out of the box. For example this code is autogenerated in the viewModelConfigDiff for the data source of the new list added to the page:

 

"DataGrid_3t5aefx": {

                        "isCollection": true,

                        "modelConfig": {

                            "path": "DataGrid_3t5aefxDS",

                            "sortingConfig": {

                                "default": [

                                    {

                                        "direction": "asc",

                                        "columnName": "Number"

                                    }

                                ]

                            }

                        },

 

Changing columnName and direction here will also change it on the page after refresh. So your code above should be changed to the one I shared and should be inside the viewModelConfigDiff array of the schema to change the default sorting.

Hello, 

Let me share some articles to explain the Creatio app's filtering. In the example of code that you've posted there is no filtering.

Please check the next examples of filtering, it can be helpful for your business task:

https://community.creatio.com/questions/building-column-path-filter-rec…

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

https://community.creatio.com/questions/sort-objects-server-side

Anhelina, But I'm not saying anything about filtering! I'm talking about Sorting and the new interface. I don’t see anything about the new interface in the articles you cited.

Шевчук Святослав,

 

this can be checked out of the box. For example this code is autogenerated in the viewModelConfigDiff for the data source of the new list added to the page:

 

"DataGrid_3t5aefx": {

                        "isCollection": true,

                        "modelConfig": {

                            "path": "DataGrid_3t5aefxDS",

                            "sortingConfig": {

                                "default": [

                                    {

                                        "direction": "asc",

                                        "columnName": "Number"

                                    }

                                ]

                            }

                        },

 

Changing columnName and direction here will also change it on the page after refresh. So your code above should be changed to the one I shared and should be inside the viewModelConfigDiff array of the schema to change the default sorting.

Show all comments

I'm looking to trigger page data validation in a specific circumstance from code. I've found that you can use

request.$context.validate()

within client event handlers to trigger the OOTB fields validation for the page, but this just returns an object representing any/all errors in validation for the data. What would make sense to do in our use case after that would be to trigger the NotifyService message you usually see when saving fails due to such validation checks, but I can't see how to trigger it/how to fetch the string that should be shown in the message. I located a method that looks like it is performing this task for the OOTB save validation, called getValidationErrorMessage, which would be passed the request context and the error object returned by the validate function, but this method doesn't seem to be available for use.

 

Has anybody had any luck with triggering validation in Freedom UI and then displaying the OOTB message based on that validation result? Any help would be greatly appreciated. We're currently running on 8.1.0

Like 2

Like

4 comments

Hello,

If I'm not mistaken, you can use simple OOTB validation that is described here https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…

Hi Dmytro,

 

This doesn't give us a way to trigger the validation manually though unfortunately. What we were trying to achieve was to show the validation message to users without saving/trying to save the record at that point in time. We ended up making our own very basic error message that shows the results returned by

request.$context.validate()

if there are any and stops the user progressing in our custom path, but it would be good to be able to tap into the OOTB error toast message so it's a little more detailed and polished.

Harvey Adcock,

 

Hello! 

Unfortunately, so far, we don't have the functionality to trigger the OOTB validation snackbar-message without saving /trying to save the record. 

We have registered your suggestion, and our R&D team will consider implementing it in future releases.

Thank you for making our product better!

 

Best regards, 

Natalia

Harvey Adcock,

Dear Harvey,

 

See this community article, I think it could help you to answer your question https://community.creatio.com/questions/dynamic-parameter-validator-freedom-ui

 

Regards,

Julio

Show all comments

We're trying to set it up so that one of our mini pages used for record creation (wherever the record creation is started from, as there are several screens with a button to create the record) always has a default value set. We can't set the default on the entity, as records coming in from the integrations shouldn't have these fields set to any default, only set to whatever comes in through the interface. Is there any configuration that can be done to set default values for pages themselves?

 

We know about setting defaults when calling the crt.CreateRecordRequest request which is done from the calling page, but would ideally like to be able to set it one time for the creation mini page itself to avoid code duplication. We are on 8.1.0

Like 1

Like

5 comments

You can setup a business rule if the attribute is not filled in then you set a static value. This will work only on the interface.

Thanks for the suggestion Franck, and interesting/concerning that the entity-level business rules only apply when creating records through the UI and not for all data!

 

Unfortunately the business rule value setting is much too limited in Creatio for what we need, only being able to set to a constant/static value which is defined when setting up the business rule. We need to be setting the value based on some logic through code, but would ideally be doing so with declarative code rather than imperative code which modifies the fields manually.

Hello Harvey,

The most general way to set the default values for a mini-page is to transfer them in ModelInitConfigs via crt.OpenPageRequest:

modelInitConfigs: [{defaultValues: [{AttributeName: 'AttributeValue'}]}]

But if you want to avoid transferring the values in every place you open the mini-page, consider the following implementation in the mini-page view model:

  1. Set the attribute value in the "crt.HandleViewModelInitRequest":
    request.$context.AttributeName = “AttributeValue”;
  2. Provide it not to be overridden to default null value in "crt.HandleViewModelAttributeChangeRequest":
    if (request.attributeName === "AttributeName" && request.value === null) {
          request.$context.AttributeName = “AttributeValue”;
    }

     

Best regards, Natalia

Hi Natalia,

 

Thanks for the reply, those will definitely be useful - for example I didn't know you could set default values when calling the crt.OpenPageRequest, I thought it was only possible to do so using the crt.CreateRecordRequest, so thanks for that!

 

I believe the workaround for putting the logic in the mini-page would mostly work, but with the following caveats:

1. You would not be able to clear the value of the field manually, which is unfortunate

2. This would make a change to the page that would cause the confirmation dialog to appear if closing the mini-page without the user making any modifications to data - not the end of the world, but it would be nice to avoid that

 

A quick question - what is the difference between simply assigning a request.$context.AttributeName using 

request.$context.AttributeName = "value"

Vs using the _setAttributeValue method in your reply? Is there any functional difference between the two, or is it just preference?

 

Many thanks,

Harvey

Harvey Adcock,

 

Hi, 

Sure, setting the mini page default values via HandleViewModel InitRequest and HandleViewModelAttributeChangeRequest has some disadvantages. That’s why we recommend using ModelInitConfigs in OpenPageRequest.

 

However, it may still be used if the user doesn’t need to set the field value to null. Especially considering the facts that:

- removing the string field means setting a value to an empty string (not null);

- the numeric field value might be set to 0 instead of removing it.

 

The question of silent saving has already been discussed in the separate feed - https://community.creatio.com/questions/it-possible-make-changes-attributes-code-freedom-ui-silently .

 

Regarding your question about setting the attribute value – I clarified it with our R&D department. There is no functional difference between the two approaches, but only the direct assigning is recommended to use as the most stable method:

request.$context.AttributeName = "value"

Thank you for such an important question. I have already changed my examples accordingly.

 

Best regards,

Natalia

Show all comments

Hi,



Currently in Classic UI we can add files or links in the attachements, Anybody knows where to insert the link for attachements in Freedom UI ?



Kind regards,



Damien

Like 2

Like

2 comments

Hello,

 

You can use this documentation:



Work with attachments | Creatio Academy



Regards,

Orkhan

Hi Orkhan,



Thank you but these are Classic UI instructions, I am looking for the equivalent in Freedom UI as new fresh installations do not have classic UI alternative in some sections.







Do you have such documentation & functionality for Freedom UI ?



Thanks,



Damien







 

Show all comments

Is there any way to undo/cancel a change that triggers the crt.HandleViewModelAttributeChangeRequest handler? The use case is that a field is set in the crt.HandleViewModelInitRequest handler, but this setting of the value gets immediately overwritten by the OOTB system that sets up the page it seems. So I would like to be able to conditionally cancel the setting of this field by the page. Any help would be greatly appreciated. We're currently on 8.1.0

Like 1

Like

4 comments

Hi Harvey,

 

We can create an attribute to store a value that you want to set in HandleViewModelInitRequest. Then, in HandleViewModelAttributeChangeRequest, we can check if the current field value matches the one you previously set. If it does not match, we can assign the stored value to it. This way, we ensure that the desired value is assigned to the field.



In the given example, we have created an attribute named "UsrInitialValue".

viewModelConfig: /**SCHEMA_VIEW_MODEL_CONFIG*/{
			"attributes": {
				"StringAttribute_ljc6yh6": {
					"modelConfig": {
						"path": "PDS.UsrTestString"
					}
				},
				"UsrInitialValue": {}
			}
		}/**SCHEMA_VIEW_MODEL_CONFIG*/,



This attribute is used to store a specific value that we set during the initialization process. In the crt.HandleViewModelInitRequest handler, we set a value for the request.$context.UsrInitialValue. And in crt.HandleViewModelAttributeChangeRequest, we check if the current field value matches the value we set previously in the request.$context.UsrInitialValue. If they don't match, we update the field with the new value.

 

handlers: /**SCHEMA_HANDLERS*/[
			{
				request: "crt.HandleViewModelInitRequest",
				handler: async (request, next) => {
					request.$context.UsrInitialValue = "testInit";
					request.$context.StringAttribute_ljc6yh6 = await request.$context.UsrInitialValue;
					return next?.handle(request);
				}
			},
 
			{
				request: "crt.HandleViewModelAttributeChangeRequest",
				handler: async (request, next) => {
					var srtValue = await request.$context.StringAttribute_ljc6yh6;
					var initVal = await request.$context.UsrInitialValue;
					if (request.attributeName === 'StringAttribute_ljc6yh6' && srtValue != initVal) {
						request.$context.StringAttribute_ljc6yh6 = initVal;
					}
					return next?.handle(request);
				}
			}
		]/**SCHEMA_HANDLERS*/,

 

Artem Smyrnov,

 

I think this would prevent any modification to the data, including intended changing by the user or system. Obviously it could be changed to add some more conditions, but really the main thing we want/frequently need is for the crt.HandleViewModelInitRequest request to be able to initialise a value and not be overwritten by the standard page loading stuff (loading default values for the entity, clearing out the field where there are no default values etc). I'm pretty sure this was possible in Classic UI, it just doesn't seem to be currently in Freedom UI without some pretty nasty hacks.

Harvey Adcock,

There is no logic that could be used to revert changes to the column value that were done by the handler.

As a solution, you need to create a column that will not use any other handler and set the value using your custom handler. This will prevent the value from being overwritten by other handlers or custom logic.

We have a workaround in place, but this capability has been required a few times - it would be good if Creatio supported setting values on the page in the init handler (or some other handler, maybe a new initvalues handler or something) since per-page default values is often required.

Show all comments

In Classic UI, the approvals and the tasks were all shown in the action dashboard, where it says "Next Steps".

Now in FreedomUI, only tasks are being shown there, no approvals. Is that the expected behavior? is there any way to show approvals there as in classic UI?

 

Thanks!

Like 4

Like

2 comments

Also wondering how to better use the approvals in Freedom UI, seems slightly less intuitive for users.



 

Hello, 



It's expected behavior, the approval displaying only in a separate 'approvals' component: 

Show all comments

In classic UI we used to override/extend the ActivityDashboardItemViewModel in order to handle the "Complete" activity button click.

 

How can we do this using FreedomUI?

 

Thanks!

Like 3

Like

2 comments

Hello,

 

I'm afraid we don't have any possibility to contol this behavior using page handlers. But if anyone has an example to share please share it. I've registered a task for our R&D team to make it possible to control it using no-code tools.

Oleg Drobina,

it would be great to be able to intercept it via request handlers in code too. Overriding the behaviour is essential to a lot of our customisation for clients.

Show all comments

Hello, 

 

Do you know how to mask first 12 digits of a Credit Card in Freedom UI Creatio?

 

Example :-

Credit Card Number :- 2345-2121-1225-8909

After masking I want to see as ****-****-****-8909 in Freedom UI.

 

Thanks,

Like 1

Like

1 comments

You can try using the password input which will mask the entire text as ****. This control doens't appear in the toolbox, so to add it, you could add an input, then in the code change "type": "crt.Input" to "type": "crt.PasswordInput". You can see an example of this control in the page SysUserProfilePage (user profile page)

 

If you need it more how you described, showing the last 4 digits, you would need to implement your own custom control. You can see details for that here: https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platfor…

 

Ryan

Show all comments
Question

Hi Guys,

 

How to compare two dates in Freedom UI and display warning if first date is greater than second date in Freedom UI.

 

Thank you!

Like 0

Like

2 comments

You can use this example for date validation in the page handler code

    //----------- DATE VALIDATION --------//

        request: "crt.HandleViewModelAttributeChangeRequest",

        handler: async (request, next) => {

        // ------------Get the selected date values--------//

        var dateFrom = await request.$context.DateTimeAttribute_6jtq65k;

        var dateTo = await request.$context.DateTimeAttribute_vg9eydm;

        // Check if dateFrom and dateTo values are valid

        if (!dateFrom || !dateTo) {

            return;

        }

        //------Convert the date values to JavaScript Date objects---------//

        var jsDateFrom = new Date(dateFrom);

        var jsDateTo = new Date(dateTo);

        //---------Check the date values and display an error message-----------//

        if (jsDateTo < jsDateFrom) {

            var errorMessage = "Please choose a different 'dateTo' value. It should be greater than 'dateFrom'.";

            Terrasoft.utils.showMessage({

                caption: errorMessage,

                message: errorMessage,

                buttons: ["ok"],

                defaultButton: 0,

                style: Terrasoft.MessageBoxStyles.RED

            });

            request.$context.DateTimeAttribute_vg9eydm = null;

            return;

        }

Abhishek,

Thanks Abhishek, Instead of "handler" is there any way  to use "validators"? 

Show all comments