Hi,

 

Is it possible to reduce the time frame of the period selection ? Creatio was set up in early 2020 only, but shows selection going back all the way to 2015 in Forecast section.

 

Found the "periods" lookup, but unsure if I can delete periods without breaking records in the system.

 

Like 0

Like

1 comments

Hello Damien,

 

Hope you're doing well.

 

You can try to delete the unnecessary period records, it shouldn't affect the functionality of the system as far as it doesn't have strict bindings to the sections' functionality. Also, you can try to change the date to a future time or other actual periods for you.

 

Best regards,

Roman

Show all comments

Hi Team,

I would like to change the week value in calendar activity.
By default we have Sunday to Monday, i need it to be displayed as Monday to Sunday.

Please find the attachment below,

we see that it is loaded from these modules FixedFilterViewModelV2,FixedFilterViewV2

in FixedFilterViewV2, getPeriodFixedButtonsViewConfig(Filtername) function generates the calendar icon buttons for current day, current week, current month filter and they are binded to "SetCurrentDayPeriod", "SetCurrentWeekPeriod" and month menu button collection correspondingly.
 

function getPeriodFixedButtonsViewConfig(filterName) {
			var localizableStrings = resources.localizableStrings;
			var localizableImages = resources.localizableImages;
			var dayButton = getFixedButtonBaseConfig({
				click: {bindTo: "setCurrentDayPeriod"},
				hint: localizableStrings.TodayCaption,
				imageConfig: localizableImages.DayPeriodButtonImage,
				markerValue: "day",
				classes: {
					wrapperClass: ["day-period-fixed-filter-wrapper-class"],
					imageClass: ["period-fixed-filter-image-class"]
				},
				visible: {bindTo: "dayButtonVisible"}
			});
			var weekButton = getFixedButtonBaseConfig({
				click: {bindTo: "setCurrentWeekPeriod"},
				hint: localizableStrings.CurrentWeekCaption,
				imageConfig: localizableImages.WeekPeriodButtonImage,
				markerValue: "week",
				classes: {
					wrapperClass: ["day-period-fixed-filter-wrapper-class"],
					imageClass: ["period-fixed-filter-image-class"]
				},
				visible: {bindTo: "weekButtonVisible"}
			});
			var monthButton = getFixedButtonBaseConfig({
				imageConfig: localizableImages.MonthPeriodButtonImage,
				hint: localizableStrings.SelectPeriodCaption,
				markerValue: "month",
				classes: {
					imageClass: ["period-fixed-filter-image-class"]
				},
				visible: {bindTo: "monthButtonVisible"}
			});
			monthButton.menu = {
				items: [{
					className: "Terrasoft.MenuItem",
					caption: localizableStrings.YesterdayCaption,
					click: {bindTo: "setPeriod"},
					tag: filterName + "_Yesterday"
				}, {
					className: "Terrasoft.MenuItem",
					caption: localizableStrings.TodayCaption,
					click: {bindTo: "setPeriod"},
					tag: filterName + "_Today"
				}, {
					className: "Terrasoft.MenuItem",
					caption: localizableStrings.TomorrowCaption,
					click: {bindTo: "setPeriod"},
					tag: filterName + "_Tomorrow"
				}, {
					className: "Terrasoft.MenuSeparator"
				}, {
					className: "Terrasoft.MenuItem",
					caption: localizableStrings.PastWeekCaption,
					click: {bindTo: "setPeriod"},
					tag: filterName + "_PastWeek"
				}, {
					className: "Terrasoft.MenuItem",
					caption: localizableStrings.CurrentWeekCaption,
					click: {bindTo: "setPeriod"},
					tag: filterName + "_CurrentWeek"
				}, {
					className: "Terrasoft.MenuItem",
					caption: localizableStrings.NextWeekCaption,
					click: {bindTo: "setPeriod"},
					tag: filterName + "_NextWeek"
				}, {
					className: "Terrasoft.MenuSeparator"
				}, {
					className: "Terrasoft.MenuItem",
					caption: localizableStrings.PastMonthCaption,
					click: {bindTo: "setPeriod"},
					tag: filterName + "_PastMonth"
				}, {
					className: "Terrasoft.MenuItem",
					caption: localizableStrings.CurrentMonthCaption,
					click: {bindTo: "setPeriod"},
					tag: filterName + "_CurrentMonth"
				}, {
					className: "Terrasoft.MenuItem",
					caption: localizableStrings.NextMonthCaption,
					click: {bindTo: "setPeriod"},
					tag: filterName + "_NextMonth"
				}]
			};
			return [dayButton, weekButton, monthButton];
		}

 

In FixedFilterViewModelV2 we see the below functions
 

        function setCurrentDayPeriod() {
			this.setPeriod("PeriodFilter_Today");
		}
 
		function setCurrentWeekPeriod() {
			this.setPeriod("PeriodFilter_CurrentWeek");
		}
 
		function setPeriod(tag) {
			if (!tag) {
				return;
			}
			var indexOfSeparator = tag.lastIndexOf("_");
			if (indexOfSeparator === -1) {
				return;
			}
			var filterName = tag.substring(0, indexOfSeparator);
			var periodName = tag.substring(indexOfSeparator + 1);
			var periodFilterConfig;
			Terrasoft.each(this.config.filters, function(filterConfig) {
				if (filterConfig.name === filterName) {
					periodFilterConfig = this.getPeriodFilterConfig(filterConfig);
				}
			}, this);
			if (!periodFilterConfig) {
				return;
			}
			var startDate = new Date();
			var dueDate;
			switch (periodName) {
				case "Yesterday":
					startDate = Terrasoft.startOfDay(Ext.Date.add(startDate, "d", -1));
					dueDate = Terrasoft.endOfDay(startDate);
					break;
				case "Tomorrow":
					startDate = Terrasoft.startOfDay(Ext.Date.add(startDate, "d", 1));
					dueDate = Terrasoft.endOfDay(startDate);
					break;
				case "PastWeek":
					startDate = Terrasoft.startOfWeek(Ext.Date.add(startDate, "d", -7));
					dueDate = Terrasoft.endOfWeek(startDate);
					break;
				case "CurrentWeek":
					startDate = Terrasoft.startOfWeek(startDate);
					dueDate = Terrasoft.endOfWeek(startDate);
					break;
				case "NextWeek":
					startDate = Terrasoft.startOfWeek(Ext.Date.add(startDate, "d", 7));
					dueDate = Terrasoft.endOfWeek(startDate);
					break;
				case "PastMonth":
					startDate = Terrasoft.startOfMonth(Ext.Date.add(startDate, "mo", -1));
					dueDate = Terrasoft.endOfMonth(startDate);
					break;
				case "CurrentMonth":
					startDate = Terrasoft.startOfMonth(startDate);
					dueDate = Terrasoft.endOfMonth(startDate);
					break;
				case "NextMonth":
					startDate = Terrasoft.startOfMonth(Ext.Date.add(startDate, "mo", 1));
					dueDate = Terrasoft.endOfMonth(startDate);
					break;
				default:
					startDate = Terrasoft.startOfDay(startDate);
					dueDate = Terrasoft.endOfDay(startDate);
					break;
			}
			this.suspendUpdate = true;
			this.set(periodFilterConfig.startDateColumnName, startDate);
			this.set(periodFilterConfig.dueDateColumnName, dueDate);
			this.suspendUpdate = false;
			if (this.filterChanged) {
				this.filterChanged();
			}
		}

In SetPeriod() function we call Terrasoft.startOfWeek & Terrasoft.endOfWeek based on Switch Case, which is responsible for sunday to Saturday filter display (calculations).

In DateUtils.js, we see the below

Terrasoft.utils.date.startOfWeek = function(dateValue) {
	var dateDiff = dateValue.getDay() + (1 - Terrasoft.Resources.CultureSettings.startDay);
	dateDiff = dateDiff ? 1 - dateDiff : -6;
	return Terrasoft.startOfDay(Ext.Date.add(dateValue, Ext.Date.DAY, dateDiff));
};
 
 
Terrasoft.utils.date.endOfWeek = function(dateValue) {
	var dateDiff = dateValue.getDay()  + (1 - Terrasoft.Resources.CultureSettings.startDay);
	dateDiff = dateDiff ? 7 - dateDiff : dateDiff;
	return Terrasoft.endOfDay(Ext.Date.add(dateValue, Ext.Date.DAY, dateDiff));
};

Please guide on how to replace or extend these modules and achieve a week value from "Sunday to Saturday into Monday to Sunday".

Note:
we could not replace these modules (FixedFilterViewModelV2,FixedFilterViewV2)
 by using "Replacing client Module", if we do so we get below error,

Please guide on how to extend and where to consume the extended module and procedure.

Thanks in Advance!
 

Regards,

Bhoobalan P.

Like 0

Like

4 comments

Hi Bhoobalan,

 

The beginning of the week is connected to the system user localization and as you correctly pointed the main logic is stored in the DateUtils.js file. The only way to modify this logic is to modify the content of two functions: startOfWeek and endOfWeek in the following manner:

Terrasoft.utils.date.startOfWeek = function(dateValue) {
    var dateDiff = dateValue.getDay() + (Terrasoft.Resources.CultureSettings.startDay);
    dateDiff = dateDiff ? 1 - dateDiff : -6;
    return Terrasoft.startOfDay(Ext.Date.add(dateValue, Ext.Date.DAY, dateDiff));
};
 
...
 
Terrasoft.utils.date.endOfWeek = function(dateValue) {
	var dateDiff = dateValue.getDay()  + (Terrasoft.Resources.CultureSettings.startDay);
	dateDiff = dateDiff ? 7 - dateDiff : dateDiff;
	return Terrasoft.endOfDay(Ext.Date.add(dateValue, Ext.Date.DAY, dateDiff));
};

Once done the application should be restarted, the application pool recycled and the Redis flushed. As a result the week will start on Monday as needed.

 

Best regards,

Oscar

Please also note that you won't be able to do that from the application UI and it should be done directly in the file (located at root_app_path\Terrasoft.WebApp\Resources\ui\Terrasoft\utils\common directory). If you want to do this in the cloud-based app you need to provide us with the file, directory and application name where this should be done.

 

UPD: logic described here won't work in the cloud based apps because of the bundling service in the cloud.

 

Best regards.
Oscar

And also you need to delete browser cookies for the website and clean cache in the browser so changes could be applied in the browser.

 

Best regards,

Oscar

Oscar Dylan,

Thanks much!

Show all comments

Hi Team,

I would like to prevent selecting the future date in the date field.
Kindly help me with any insight on this.

Note: All the future date should be greyed out and is not able to select (if it is clicked it shouldn't be selected or populated in the date field).

 

 

 

Thanks in Advance!

Regards,

Bhoobalan P.

Like 0

Like

3 comments

Hi Bhoobalan,

 

Please use the column validator instead that will do the same task:

setValidationConfig: function() {
              this.callParent(arguments);
              this.addColumnValidator("UsrDatetime1",this.dateTimeColumnValidator);
            },
          	dateTimeColumnValidator: function(){
              console.log(this.get("UsrDatetime1"));
              var invalidMessage = "";
              console.log(this.getSysDefaultValue(Terrasoft.SystemValueType.CURRENT_DATE_TIME));
              if (this.get("UsrDatetime1")>this.getSysDefaultValue(Terrasoft.SystemValueType.CURRENT_DATE_TIME)){
               	invalidMessage = this.get("Resources.Strings.ErrorMessage");
              } 
                return {
                  invalidMessage: invalidMessage
                };
              },

Just replace the UsrDatetime1 column with your date\rime column name and also create a localizable string with the "ErrorMessage" code.

 

Best regards,

Oscar

Oscar Dylan,

Thanks much for the precious response!

But still we could select the future date value, And after validation we throw a error message below the corresponding field name. 

We need to block selecting the future date, which could be possibly achieved via Jquery as below,

$("#dateField").datepicker({
    maxDate: 0
});

How could we achieve the same in our CREATIO Date field ?

Regards,

Bhoobalan P.

Bhoobalan Palanivelu,

 

This validator will also return a validation message upon saving a record with an incorrect date, so it's not possible to select the date\time grater than the current date\time:

And this is much easier than creating a custom logic for the date selector modal window so please use this approach.

 

Best regards,

Oscar

Show all comments

Hi

How can I change the default time interval in date time field? by default it's 15 mins.

 

Thank you

Mohamed

 

Like 0

Like

7 comments

Dear Mohamed,

The interval can only be changed in TimeEdit.js located in  application folder. The path is: ...Terrasoft.WebApp\Resources\ui\Terrasoft\controls\timeedit

The required control can be found in the file https://prnt.sc/koasrh 

Best regards,

Dean

Dean Parrett,

Dear Dean

I've edited the file, compiled all items and cleared the browser and Redis cache. But I still get the 15 mins default value.

And the instruction below still returns 15.

Ext.create("Terrasoft.TimeEdit").interval // returns 15

I think there is a missing step here. (Maybe a webpack build is needed).

Thank you

Mohamed

 

Dear Mohamed,

Try to clear Redis, restart the application and let us know if that helped.

Dean

Dean Parrett,

No, it doesn't help. I still cannot change the interval.

Dear Mohamed,

Unfortunately, it is difficult to determine the root cause of the issue. I changed the “timeedit.js” file, compiled the application (compile modified items https://prnt.sc/qxzx9m ) then cleared the browser cache https://prnt.sc/qxzy4c and the interval has been successfully changed from 15 to 10 minutes. Please try to repeat all my steps.

For more detailed assistant please contact technical support.

Best regards,

Norton

Norton Lingard,

I have followed the steps, but I can't get the timeedit.js file in the dev tools.

Thank you

Mohamed

Dear Mohamed,
In order to change the “timeedit.js” file please do the following:
1. Please deploy an application on-site. Please find more information about it in the article by the link below:
https://academy.creatio.com/documents/administration/7-15/installing-cr…
2. Find the “timeedit.js” file that is located in the application folder. The path is:
...Terrasoft.WebApp\Resources\ui\Terrasoft\controls\timeedit\timeedit.js
3. Change this file and follow all next steps that were described in my previous post.
Best regards,
Norton 
 

Show all comments

Hi all,

       I try to set current date when click button by function

       var today = new Date();
       this.set("UsrSentAt", { value: today });

       But system shows error "The entered value does not match the column type" and can't display value on datetime picker. How can I set value for it?

Thanks

Like 0

Like

3 comments

Hello Toan!

Please double check if the "UsrSentAt" attribute has DATE type. 
Also, you should pass the value as it is, not creating the object.
this.set("UsrSentAt",   today );

For example:
I have created attribute 
"Date": {
                dataValueType: Terrasoft.DataValueType.DATE,
                type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN
              }

And I was able to successfully set it :
onEntityInitialized: function(){
                this.callParent(arguments);
                debugger;
                var date  = new Date();
                this.set("Date", date);
            }

Hi Alex,

Thanks for replying, see my screenshoot

Toan Mai,

Anyway, example that I sent above should work. Just pass the raw value in the set function instead of new object. 

this.set("UsrSentAt",   today );

Show all comments