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