Hi

 

I have used the sandbox to transfer data from edit page to detail. It works as usual  if you open the  record from a section . But If you open the edit  record from detail and go back to the detail through the link in record and open another record, the this points to old record not the new record

Like 0

Like

3 comments

Hello,

 

Could you please describe the issue in more detail, providing a step by step instructions with screenshots?

Mira Dmitruk,

 

There are two sections (projects & Requests)  and a detail  ( Submitter's Documents). The Requests section is a detail in projects section.  The task is to send information of edit page(requests)  to detail(documents).  

 

 

I used the sandbox to tranfer data. It works well when you open request page record from requests section and I was able to send infomation from edit page to detail.

 

The  issue lies  when you open the requests record from the projects  and click on the detail tab. For the first time it works well. But when you navigate back to projects page through the link  and select another record from the detail.

 

 

 

This time when you click on the detail the 'UsrRequestType" ,it shows the old record information not the newly opened one. The 'this' points to the first opened record information.  Is there any way to access the newly opened record information.

 

 

Thanks 

Rakshith Dheer

Rakshith Dheer Reddy,

 

Hello,

 

As described in the ticket registered on our side please change the approach from calling a custom sandbox message to using the basic sandbox message like:

 

var reqType = this.sandbox.publish("GetColumnsValues", ["UsrRequestType"],

                    [this.sandbox.id]);

 

called from the detail. It will always return the proper value of currently opened main record.

Show all comments

Hi Community,

 

I have the following requirement where I need to open the ActivitySectionV2 page from a detail schema. More specifically, I've created a button in a custom detail which, when pressed, opens the ActivitySectionV2 page, as you can see in the following image.

 

In addition to opening the page, this button should transfer the records Contact Id from the detail  to the Activity section. Inside the ActivitySectionV2 page, I'll use these values for the QuickFilters of the Employees.

 

 

To achieve this, I tried using messages between modules. And also, loading the section module through the detail but both didn't work. 

 

Detail Schema

messages: {
			"SetActivityFilters": { 
				mode: Terrasoft.MessageMode.BROADCAST,
				direction: Terrasoft.MessageDirectionType.PUBLISH
			}
},
methods: {
openActivities: function(){
 
				var collection = this.get("Collection");
 
				var contactIds = [];
 
				for(var i = 0; i < collection.collection.items.length; i++){
					if(collection.collection.items[i].values.imdContact !== undefined){
						contactIds.push(collection.collection.items[i].values.imdContact.value);
					}
				}
 
				window.console.log(contactIds);
 
 
 
				//Open Activity + Send Contacts
				this.sandbox.publish("SetActivityFilters", contactIds, [this.sandbox.id]);
				this.sandbox.publish("PushHistoryState", {hash: "SectionModuleV2/ActivitySectionV2"});
 
 
				/*this.sandbox.loadModule("SectionModuleV2", {
					renderTo: "centerPanel",
					//id: "SectionModuleV2_ActivitySectionV2",
					instanceConfig: {
						parameters: {
							ContactIds: contactIds 
						},
						schemaName: "ActivitySectionV2",
						isSchemaConfigInitialized: true,
						useHistoryState: true,
						//isSeparateMode: true,
						//entitySchemaName: "Activity",
				  }
		  });*/
}}

 

ActivitySectionV2

 

			messages: {
			         "SetActivityFilters": { 
				          mode: Terrasoft.MessageMode.PTP,
				          direction: Terrasoft.MessageDirectionType.SUBSCRIBE
			         }
		    },		
            methods: {
             init: function(){
				this.callParent(arguments);
				this.sandbox.registerMessages(this.messages);
				this.processMessages();
 
				//window.console.log(this.parameters);
			},
 
			onRender: function(){
				this.callParent(arguments);
			},
 
			processMessages: function() {
				this.sandbox.subscribe("SetActivityFilters", function(result){
 
					window.console.log("'MessageToSubscribe' received" + result);
 
				}, this, ["SectionModuleV2_CaseSection_CardModuleV2_detail_imdSchema54bae29aDetail1d5019a5imdCaseParticipants"]);
			}}

Could you please tell me if there is any other way I can achieve this requirement and what is wrong with my approach.

 

Thanks in Advance.

 

Best Regards,

Pedro Pinheiro

Like 1

Like

3 comments

Hello Pedro,

 

Current code you shared will open the Activity section indeed, but there is no logic in the code that will add values to the quick owner filter. And it's so since it's impossible to do via the scenario you described. Why: because to set such filtration dynamically the addNonPeriodFilterValue method from the FixedFilterViewModelV2 should be called (just check it in the debugger when selecting owner from the lookup inside the filter) and I found no ways of doing that from the init method of ActivitySectionV2. So you need to find other ways of achieving the business task.

Hi Oleg Drobina,

 

Thanks for the response.

 

Currently, to simplify the problem. I'm just trying to fully open the ActivitySection and print the values that are coming from the detail, without applying the filters.

 

To do this I had to change the initial code, because my activity was not receiving the "SetActivityFilters" message. So, what I did was to load the module instead, using the following code:

methods: {
			onActiveRowAction: function(buttonTag, primaryColumnValue) {
				this.mixins.ConfigurationGridUtilitiesV2.onActiveRowAction.call(this, buttonTag, primaryColumnValue);
			},
 
			init: function(){
				this.callParent(arguments);
			},
 
			openActivities: function(){
 
				var collection = this.get("Collection");
 
				var contactIds = [];
 
				for(var i = 0; i &lt; collection.collection.items.length; i++){
					if(collection.collection.items[i].values.imdContact !== undefined){
						contactIds.push(collection.collection.items[i].values.imdContact.value);
					}
				}
 
				window.console.log(contactIds);
 
				this.sandbox.loadModule("SectionModuleV2", {
					renderTo: "centerPanel",
					id: "SectionModuleV2_ActivitySectionV2",
					instanceConfig: {
						parameters: {
							ContactIds: contactIds 
						},
						schemaName: "ActivitySectionV2",
						isSchemaConfigInitialized: true,
						useHistoryState: false,
					}
				});
			}
}

I followed this post in the community to try to implement this https://community.creatio.com/questions/pass-parameters-section

 

When pressing the "Open Activity" button, I get this error and behaviour:

 

After some debbuging, I found that the context does not have the module that I'm trying to load. Maybe, I'm missing some dependencies.

 

 

Could you please help me understand this issue?

 

Once I figure this out, I will check another approach to apply the filters.

 

Thank you.

 

Best Regards,

Pedro Pinheiro

 

 

 

 

 

 

 

 

To pass values from the detail (in my example it was ContractDetailV2) to the ActivitySectionV2:

 

1) In the ContractDetailV2:

onOpenActivityButtonClick: function() {
				this.sandbox.publish("PushHistoryState", {
					hash: "SectionModuleV2/ActivitySectionV2",
					silent: false,
					stateObj: {
						value: "5266908c-f3d1-4c5c-9097-f0dfbdbf900b",
						displayValue: "Email Supervisor"
					}
				});
			}

Here you can pass an array in the "value" property of the stateObj object as well.

 

onOpenActivityButtonClick is a click-handler for the button:

{
                "operation": "insert",
                "name": "OpenActivityButton",
                "parentName": "Detail",
                "propertyName": "tools",
                "values": {
                    "itemType": Terrasoft.ViewItemType.BUTTON,
                    "caption": {"bindTo": "Resources.Strings.OpenActivityButtonCaption"},
                    "click": {"bindTo": "onOpenActivityButtonClick"},
                    "style": Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
                    "enabled": true
                }
            }

 

2) In the ActivitySectionV2:

define("ActivitySectionV2", [], function() {
	return {
		entitySchemaName: "Activity",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		methods: {
			init: function() {
				this.callParent(arguments);
				var shouldUpdateFilter = this.checkHistoryState();
				if (shouldUpdateFilter.value &amp;&amp; shouldUpdateFilter.displayValue) {
					var tag = "Owner";
					var row = {
						value: shouldUpdateFilter.value,
						displayValue: shouldUpdateFilter.displayValue
					}
					console.log("Row value: " + row.value + " and Row displayValue: " + row.displayValue);
				}
			},
			checkHistoryState: function() {
				var historyState = this.sandbox.publish("GetHistoryState");
				return historyState?.state;
			}
 
		}
	};
});

As a result you will be able to get passed values in the init method execution:

Show all comments

Hi community,

Anyone have idea how to use sandbox in new freedomui pages. In classic Ui we used to follow this documentation https://academy.creatio.com/docs/developer/front_end_development/sandbox/overview#case-2591. Can we do same functionality in freedomUI pages?



Thanks.

Regards,

Manideep Korni.

Like 0

Like

1 comments

Hello,

Thank you for your question!

 

Unfortunately, It is not possible to use the sandbox in Freedom UI,

but we have already registered the following suggestion for our R&D team and they will consider adding the following functionality in the upcoming releases.

 

Show all comments