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

I want to see if any opportunity changed to a stage in the previous week. I think the setting I have shows what the current stage the opportunity was in.  I need it to show if it ever changed to that stage during that timeframe

 

Like 0

Like

1 comments

You could create a date field and populate it automatically in a business process when the opportunity stage changes. That way you will have the exact date it was updated. Depending on requirements you could do this for each stage

Show all comments
"PDS_UsrActualFuelRemaining_s06444m": {
                        "modelConfig": {
                            "path": "PDS.UsrActualFuelRemaining"
                        },
                        "validators": {
                            "MyNumberValidator": {
                                "type": "usr.MonthNumberValidator",
                                "params": {
                                    "minValue": "0",
                                    "message": "Допустимі значення від 0 до 500",
                                    "maxValue": "500"
                                }
                            }
                        }
                    },

 

If I specify a range, the validator works. But when I try to use <strong>var OldWorkHour = await request.$context.PDS_UsrWorkHours_sjx2srh;</strong>, I get an error.

Could you please help me figure out why this happens and how to fix it?

 

 "usr.MonthNumberValidator": {
   validator: function(config) {
       return function(control) {
           var controlValue = control.value !== undefined ? parseFloat(control.value) : null; 
 
           var minValue = config.minValue !== undefined ? parseFloat(config.minValue) : Number.MIN_SAFE_INTEGER; 
           var maxValue = config.maxValue !== undefined ? parseFloat(config.maxValue) : Number.MAX_SAFE_INTEGER; 
 
            var OldWorkHour = await request.$context.PDS_UsrWorkHours_sjx2srh;
 
           var isValueValid = controlValue >= minValue && controlValue <= maxValue;
           if (!isValueValid) {
 
               return {
                   "invalid": { 
                       message: config.message || "Введене значення не відповідає умовам"
                   }
               };
           }
 
           // Якщо все добре, повертаємо null (успішна валідація)
           return null;
       };
   },
   params: [
       {
           name: "minValue"
       },
       {
           name: "maxValue"
       },
       {
           name: "message"
       }
   ],
   async: false
},
Like 0

Like

2 comments

Hi,

 

And what is the datatype for the PDS_UsrWorkHours_sjx2srh and UsrActualFuelRemaining? And what is the error message you receive?

Hello,
The ability to add dynamic parameters to a validator is still under development, as a way around you can try using global variables like window. For example

handlers: /**SCHEMA_HANDLERS*/[
{
    request: "dw.StartDateChange",
    handler: async (request, next) => {
        window.StartDate = await request.$context.DateTimeAttribute_lpcf566;
        if(request.$context.IsStartDateInited) {
            request.$context.validate();
        }
        request.$context.IsStartDateInited = true;
        return next?.handle(request);
    }
}]                
...        

"dw.StartDateIsNotNotLessThanProjectStartDate": {
    "validator": function (config) {
        return function (control) {
            return (!control.value || control.value >= window.StartDate)
                ? null
                : {"dw.StartDateValidator": {message: config.message}};
        };
    },
    "params": [
        {
            "name": "message"
        }
    ],
    "async": false
}

Show all comments

Hello,

 

I need to call a code once a record gets created for the first time. This worked using the following:

handlers: /**SCHEMA_HANDLERS*/[
			{
        request: "crt.SaveRecordRequest",
        handler: async (request, next) => {

 

however what this does is execute the code for each attribute value change, which is not what is needed. How can I call this exactly once just when the record is created for the first time and that's it, without having to call it again for each save request? Thanks

 

Note: I have tried replacing SaveRecordRequest with CreateRecordRequest, however the code was not executed once saving, or on any save.

 

Best,

Mohamad

Like 0

Like

9 comments

You can use the CardState to see if the record is in add mode (record is being added, saved for first time) or edit mode:

const mode = await request.$context.CardMode;
if (mode === “add”) {
    //
}

If you need to call some code exactly once when a record is created, I'd suggest moving the whole logic to backend. Specifically EntityEventListener and implement OnInserting or OnInserted methods to call your logic before or after the record is saved

Ryan Farley,

Hey Ryan,

 

Thanks for the reply, however that didn't work. The CardMode returns undefined, and when inspecting it in developer tools (request.$context object) the value is always 'edit' , when inserting the first time or when updating. Is there anything else I can do to fix the issue? Thanks

 

Best,

Mohamad

Yurii Sokil,

Hey Yurii,

 

Thanks for the reply, I have tried moving the logic to backend, however I encountered some issues. The overloaded method OnInserted cannot be async, and therefore I cannot call APIs directly from that method.

There is another option to call asynchronously using this method https://academy.creatio.com/docs/8.x/dev/development-on-creatio-platform/back-end-development/objects-business-logic#title-2173-11 . However that doesn't solve the problem as if there were any errors when executing the asynchronous code, the record gets saved normally without indicating errors. Its a fire and forget operation and I need something that prevents a record from being inserted if the API call failed. Is there any way I can achieve this? Thanks for help

 

Best,

Mohamad

Mohamad Salhani,

If all you're after is to set up an auto number column, you can use the new auto number column default value. See https://customerfx.com/article/working-with-autonumber-fields-in-creatio/

Ryan

Ryan Farley,

No, so basically I need to populate a field once a record is created, and the value comes from an external API that I have to call

Ryan Farley,

Thanks for the support, I was finally able to solve it by checking the createdOn and modifiedOn dates for the record and see if they are equal, this way I can identify if the record was added for the first time or not. 

Thanks again!

Hi Mohamad, 
You can use AsyncPump.Run() to call async methods synchronously in your event listener. Also you can override OnInserting rather than OnInserted so your logic is called before the record is actually saved. 

Show all comments

Hi There,

 

is it possible to configure the Timer Component, so it displays in days, weeks, months instead of hrs & minutes? 

i.e to count down 12month of a product warranty or to count up how long a warranty claim has been open.

 

thanks!

Like 0

Like

2 comments
Best reply

The timer will adjust to the units that makes the most sense for the time period. I have a timer component that is set as a "Count up timer" using the time since a case was created. If the time period is short it displays hours and minutes.

If the time period is long it automatically switches to months & days:

Ryan

The timer will adjust to the units that makes the most sense for the time period. I have a timer component that is set as a "Count up timer" using the time since a case was created. If the time period is short it displays hours and minutes.

If the time period is long it automatically switches to months & days:

Ryan

Ryan Farley,

Thank you Ryan, that's great! I have been hesistant to adding this, as it didn't make sense displaying in Hrs/Min. :)

Show all comments

Як створити звіт fastreport у версії 8.1.4? Є багато готових звітів і потрібно ще один зробити, але таку можливість забрали

Like 0

Like

1 comments

Розібрався. 

  1. 1. Потрібно створити пусту строку в таблиці FastReportTemplate
  2. 2. Новий запис в таблиці FastReportDataSource
  3. 3. Запис в SysModuleReport
  4. 4. Запис в SysModuleAnalyticsReport
  5. 5. звіт можна відкрити в сторінці "Налаштування звіту" і продовжити роботу
Show all comments

आप इनमें से किसी भी चैनल का उपयोग करके शॉप्सी ग्राहक सहायता टीम तक पहुँच सकते हैं 0 908-8566-267✅और जितनी जल्दी हो सके अपनी शिकायत दर्ज करें।

Like 1

Like

0 comments
Show all comments

Hi Community,

I’m trying to set up global search using Docker, following the documentation. However, when I attempt to run the containers for the global search service components (see image below)

 

I encounter the following error:

 

Does anyone know what might be causing this error and how to resolve it?

Thank you!

Like 0

Like

0 comments
Show all comments

Hello Community,

 

I have created a custom page as shown below and added a button to the top bar.

 

When adding a new record, I want to hide the 'Add to Timesheet' button.

 

I want to learn, how to define the method and Method Calling in UsrTasks_FormPage in schema Designer.

UsrTasks_FormPage  Schema:

 

define("UsrTasks_FormPage", /**SCHEMA_DEPS*/[]/**SCHEMA_DEPS*/, function/**SCHEMA_ARGS*/()/**SCHEMA_ARGS*/ {
 
    var IsVisible = function() {
        //Logic is to Hide the Button on New Reacord Creation
    };
    return {
     viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
                   {
                "operation": "insert",
                "name": "AddToTimesheet",
                "values": {
                    "type": "crt.Button",
                    "caption": "#ResourceString(AddToTimesheet_caption)#",
                    "color": "primary",
                    "disabled": false,
                    "size": "large",
                    "iconPosition": "only-text",
                    "visible": { bindTo:  "IsVisible" },
                    "clicked": {
                        "request": "crt.CreateRecordRequest",
                        "params": {
                            "entityName": "UsrTimesheet",
                            "defaultValues": [
                                {
                                    "attributeName": "UsrProject",
                                    "value": "$PDS_UsrProject_yuj01i4"
                                },
                                {
                                    "attributeName": "UsrTask",
                                    "value": "$Id"
                                }
                            ]
                        }
                    },
                    "clickMode": "default"
                },
                "parentName": "ActionButtonsContainer",
                "propertyName": "items",
                "index": 0
            }
     ]/**SCHEMA_VIEW_CONFIG_DIFF*/,
        viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[]/**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/,
        modelConfigDiff: /**SCHEMA_MODEL_CONFIG_DIFF*/[]/**SCHEMA_MODEL_CONFIG_DIFF*/,
        handlers: /**SCHEMA_HANDLERS*/[]/**SCHEMA_HANDLERS*/,
        converters: /**SCHEMA_CONVERTERS*/{}/**SCHEMA_CONVERTERS*/,
        validators: /**SCHEMA_VALIDATORS*/{}/**SCHEMA_VALIDATORS*/
    };
});

 

 

Regards,

Ajay K

Like 0

Like

4 comments
Best reply

If you're wanting to wire up code to run when the button in clicked, see this article: https://customerfx.com/article/adding-a-button-to-execute-custom-code-on-a-creatio-freedom-ui-page/

As for the visible property, using {bindTo: "something"} doesn't work for Freedom UI pages (that is for classic). Instead you'd add an attribute and bind it using "$AttributeName", then set that attribute elsewhere like in the model init request. 

Using attributes: https://customerfx.com/article/using-custom-attributes-on-a-creatio-freedom-ui-page/

Using the model init handler: https://customerfx.com/article/waiting-for-model-to-be-ready-and-loaded-in-the-crt-handleviewmodelinitrequest-on-creatio-freedom-ui-pages/

This article shows how to make something visible or not based on if the user is a member of a role: https://customerfx.com/article/showing-or-hiding-a-field-if-the-current…

Ryan

You can choose the visibility to "visible": { bindTo:  "IsVisible" } and add the conditions if needed:

isVisible: function() {
             if ( ---- )  
                     return true;
             return false;
}
 
OR
 
showButton: function() {
			this.callParent();
			this.set("isVisible", false);
			},

Best regards, Anhelina!

Anhelina,

Could you please clarify how to define the function in the schema?  

Is there any reference how to define the Functions in "ClientUnitSchemaDesigner". 

If you're wanting to wire up code to run when the button in clicked, see this article: https://customerfx.com/article/adding-a-button-to-execute-custom-code-on-a-creatio-freedom-ui-page/

As for the visible property, using {bindTo: "something"} doesn't work for Freedom UI pages (that is for classic). Instead you'd add an attribute and bind it using "$AttributeName", then set that attribute elsewhere like in the model init request. 

Using attributes: https://customerfx.com/article/using-custom-attributes-on-a-creatio-freedom-ui-page/

Using the model init handler: https://customerfx.com/article/waiting-for-model-to-be-ready-and-loaded-in-the-crt-handleviewmodelinitrequest-on-creatio-freedom-ui-pages/

This article shows how to make something visible or not based on if the user is a member of a role: https://customerfx.com/article/showing-or-hiding-a-field-if-the-current…

Ryan

Ajay,

Ryan is right. Suggested method works for ClassicUI but doesn't work with Freedom UI. The way to use visible property has changed. You can check the instructions from the Academy "Hide the feature on a page behind access permissions"

Show all comments

Hi All, I have setup a web service in Creatio that is working fine when I send parameters with data.

 

Sometimes I gonna call thie web service without all the parameters on the query, just one or more, it will depends on othe step before.

 

Is there a way to have a web service set up in Creatio with all parameters, but only make the call using the parameters that are not null?

Like 1

Like

3 comments

Hello!

 

It depends on whether the parameters with NULL values are required or not.

 

You can try leaving out the NULL parameters and see how the service responds. If the call fails with an error, then you'll need to include those parameters.

 

Let us know if you need further assistance!

If the API you're calling is picky about the parameters being included without values, you can add the same service method twice, once with the params, and one without. Then just call one or the other based on the needs.

Thanks for the replies, would be nice to have a way to disable a parameter, for situations like this.
For thie particular API I´m calling there are about 10 parameters available, and the way Creatio is doing, it´s sending all (query) parameters, even though its value is empty.
I´m trying to find a work around or a way to call this API sending only the required data.

Show all comments