I have code which is launched in the OnSaving event and if certain conditions are met, adds data to the current activity before saving. If the activity was updated from the Activity page then after saving but before closing the activity I want to be able to display the additional data. If the activity was completed from the Account or Contact entity then there is no requirement to refresh. Can I find out from where the Activity update is being triggered ?

Like 0

Like

1 comments

Hi,

Inside the OnSaving event, you can get a StackTrace of this event, however, you won't be able to distinguish at what object it was performed because the event itself starts from the same point.

To understand from where your activity was saved you can add a special column to it which will contain information about the save process and read it inside your OnSaving event.

For example, create a boolean column IsFromActivity page, set its default value to false and override method save() inside ActivityPageV2 and there set the value to true. Then inside OnSaving whit this column you can understand where this Activity was saved.

Show all comments

Hello Creatio Community,

I have made the Activity participant detail (Activites section) as an editable list.

When I add a new record and click on the added row ( the active row doesnt behave normally) as editable lists in other sections. I think is probably sort of bug of the system, because i have tried in fresh installations and the same thing happens.

 

I overcome this by refreshing the page so that the added row behaves normaly.

I manage to refresh the page by sending a message from a business process to the Front-End and subscribe to the message. But i refresh the whole Activity (entity), i want to refresh only the Participant detail.

This snippet is implemented in ActivityPageV2

			init: function() {
				this.callParent(arguments);
				// register our onProcessMessageReceived function to get messages from the server
				Terrasoft.ServerChannel.on(Terrasoft.EventName.ON_MESSAGE, this.onProcessMessageReceived, this);
			},
			onProcessMessageReceived: function(scope, message) {
				debugger;
				var sender = message && message.Header.Sender;
					if (sender === "RefreshDetailActivityParticipantFromBP") { //"SMRefreshPaged"
					this.reloadEntity();
				}
			}

How can i manage to refresh only the Participant detail list?

I have tried also this.reloadGridData() and this.updateDetail({reloadAll: true}); without success.

Like 0

Like

3 comments

this.reloadGridData()  is not defined in the ActivityPageV2. (console)

I think that the proper solution involves using the this.reloadGridData()  method ? Should i just add the :

mixins: {
			GridUtilities: "Terrasoft.GridUtilities"
		}

in the ActivityPageV2 ?

Any updates on this Creatio team ?

Sasori Oshigaki,

this.updateDetail({ detail: "NameOfDetail" });

You can find the "NameOfDetail" value to use by looking at the details section of the page code for your detail (it's not the name of the detail schema, but the name or Id it gave it when it added it to the page). The reloadGridData function only works from within the detail schema code itself. 

 

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

5 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!

Hello Oleg Drobina,

 

I have indeed followed all the steps below but no changes have been reflected on the date calendar. Have you updated the procedure ever since ? 

 

Thanks,

Show all comments

When I am in my section with process, in this case Lead, and attempt to schedule a Task with the schedule task -button.

 

The Start-time I choose is one week from now. However the reminder-time is initially set to the current date and time. 2019-04-05 09:28. (The reminder time is set to one week ahead of the start time, which seems strange).

Another strange thing that happens is that when i uncheck and re-check the Reminders > Responsible check-box. The Reminder date and time changes to the vales of the Activitys Start time, date and time.

Update : The issue described above only exists when I have the add-in Task Control for bpm’online (https://marketplace.bpmonline.com/app/task-control-bpmonline) installed.

Like 0

Like

1 comments

Dear Julius,

Please send an email to support@bpmonline.com. We will be glad to help!

Best regards,

Angela

Show all comments

Hello, 

I am wondering if anyone could help me solve this issue:

I am trying to have a calculation on the client side figure out how much time is between now (current time) and a due date set on the page.

1: I am grabbing the date from the dueDate field on the page and setting it to a variable 

2: Getting the current date and time and setting that to a variable

3 & 4: Initializing int (Number) variables via meta programming standards (not critical step)

5: set a while loop, checking if boolean/checkbox is checked off.

6: Subtracting values to find the difference with Math.abs();

7: defining the variable even further with Math.ceil();

8: Setting the value to a field on the page, with "this.set" 

This was working before I added the while() condition, am I going wrong somewhere?

I have already been trying to figure this out for 3 hours so hopefully someone can see my mistake and teach me something new, haha. 

 

Thanks, Community!

 

File attachments
Like 0

Like

3 comments

I would do something like this

define("ActivityPageV2", [], function() {
	return {
		entitySchemaName: "Activity",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		methods: {
			onDueDateChanged: function() {
				var now = new Date();
				var dueDate = this.get("DueDate");
				var diffHrs = this.getDateDiff(now, dueDate, "hours");
				this.set("KwlString1", diffHrs.toString());
			},
			getDateDiff: function(firstDate, secondDate, identifier) {
				var diffMs = (secondDate - firstDate); // milliseconds between firstDate & secondDate
				var diffDays = Math.floor(diffMs / 1000 / 60 / 60 / 24);
				var diffHrs = Math.floor(diffMs / 1000 / 60 / 60);
				var diffMins = Math.floor(diffMs / 1000 / 60);
				switch (identifier) {
					case "milliseconds":
						return diffMs;
					case "minutes":
						return diffMins;
					case "hours":
						return diffHrs;
					case "days":
						return diffDays;
					default:
						return diffMs;
				}
			}
		},
		attributes: {
			"OnDueDateChangeAttribute": {
				dependencies: [
					{
						columns: ["DueDate"],
						methodName: "onDueDateChanged"
					}
				]
			}
		},
		rules: {},
		businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
		diff: /**SCHEMA_DIFF*/[
			{
				"operation": "insert",
				"name": "STRING8bd032e4-6e0f-4e1c-afdb-2ecf1041382b",
				"values": {
					"layout": {
						"colSpan": 12,
						"rowSpan": 1,
						"column": 0,
						"row": 9,
						"layoutName": "Header"
					},
					"bindTo": "KwlString1",
					"enabled": true
				},
				"parentName": "Header",
				"propertyName": "items",
				"index": 17
			}
		]/**SCHEMA_DIFF*/
	};
});

 

Eugene Podkovka,

Thank you for your quick response. It works well, but I was wondering how you would modify the method to: 

  1. Only set the "diffHours" once the page is initialized.
  2. Go into a while loop checking "while a checkbox is unchecked - run loop" that would set the hours/minutes/seconds remaining every second (or n time to create a "live" feel to the process).
  3. Once checkbox is checked, stop entire process and save current time. 

I added the a while loop to check if the boolean/checkbox is false (0) and it seems to be working.

As for getting this while loop to run after initialization, this is where I am having troubles, and after going through bpm'online's and the Mozilla Foundation's Documentation I turn to you, Eugene.

methods: {
	onDueDateChanged: function() {
		var now = new Date();
		var completeTask = this.get("UsrCompleteTask");
		var dueDate = this.get("DueDate");
		var diffHrs = this.getDateDiff(now, dueDate, "minutes");
        while(completeTask == 0) {
			this.set("UsrSTRING1", diffHrs.toString());
		}
	},
	getDateDiff: function(firstDate, secondDate, identifier) {
		var diffMs = (secondDate - firstDate); // milliseconds between firstDate & secondDate
			var diffDays = Math.floor(diffMs / 1000 / 60 / 60 / 24);
			var diffHrs = Math.floor(diffMs / 1000 / 60 / 60);
			var diffMins = Math.floor(diffMs / 1000 / 60);
			switch (identifier) {
				case "milliseconds":
					return diffMs;
				case "minutes":
					return diffMins;
				case "hours":
					return diffHrs;
				case "days":
					return diffDays;
				default:
					return diffMs;
			}
		}
	},

Any knowledge on how to create this would be greatly appreciated, and thanks again on your previous response! 







 

  1. Only set the "diffHours" once the page is initialized.

Please override the "onEntityInitialized" method and set the "diffHours" there.

2. Go into a while loop checking "while a checkbox is unchecked - run loop" that would set the hours/minutes/seconds remaining every second (or n time to create a "live" feel to the process).

3. Once checkbox is checked, stop entire process and save current time. 

If you need to track when people physically work on an activity then It's a very bad idea. Just let people manage how much time they spend on a task by themselves. 

Anyway, technically it would be more correct to save a current date time value when the checkbox is checked and then save it when the checkbox is unchecked. Then calculate the difference. 

 

Show all comments