Activity Link to Open Connected Section Record page
Hi Team,
I have a Reminder Notification of an activity (Named - Test Activity). On mouse hover it shows the Connected Record. I want to open the connected record without hover. Just by clicking the activity link (Test Activity).
I have also attached a screenshot for the reference.
Regards,
Bhoobalan P.
Like
Bhoobalan Palanivelu,
Please create a replacing schema for the "Notifications module" from the "NUI" package (ReminderNotificationsSchema) and add the following code into it:
define("ReminderNotificationsSchema", ["ReminderNotificationsSchemaResources", "ConfigurationConstants", "RemindingsUtilities","BaseNotificationsSchema"], function(resources, ConfigurationConstants, RemindingsUtilities,BaseNotificationsSchema) { return { entitySchemaName: "Reminding", attributes:{}, methods: { onOpenConnectedOpportunityClick: function() { var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "Activity" }); esq.addColumn("Opportunity.Id", "OpportunityId"); esq.addColumn("Id","Id"); esq.filters.addItem(esq.createColumnFilterWithParameter(3, "Id", this.get("SubjectId"))); esq.rowCount=1; esq.filters.addItem(esq.createColumnIsNotNullFilter("Opportunity.Id")); esq.getEntityCollection(function (result) { if (result.success && result.collection.getCount() > 0) { var item = result.collection.getByIndex(0); var oppId = item.get("OpportunityId"); var requestUrl = "http://o_drobina:4334/0/Nui/ViewModule.aspx#CardModuleV2/OpportunityPageV2/edit/" + oppId; this.sandbox.publish("PushHistoryState", { hash: requestUrl }); } else { var schemaName = this.get("SchemaName"); var entityId = this.get("SubjectId"); var loaderName = this.get("LoaderName"); this.openNotificationEntityCard(schemaName, entityId, loaderName); } }, this); } }, diff: [ { "operation": "merge", "name": "NotificationActivitySubject", "values": { "itemType": Terrasoft.ViewItemType.HYPERLINK, "caption": {"bindTo": "getNotificationSubjectCaption"}, "click": {"bindTo": "onOpenConnectedOpportunityClick"}, "linkMouseOver": {"bindTo": "linkMouseOver"}, "classes": {"labelClass": ["subject-text-labelClass", "label-link", "label-url"]} } } ] }; });
Please also replace the http://o_drobina:4334 website address with an actual URL for your website. This code will make the opportunity to be opened in the same tab in case the reminder for the activity has an opportunity and it will also open an activity in case there is no opportunity for the activity once the subject of the activity is clicked.
Best regards,
Oscar
Hello Bhoobalan,
The activity (task) can have more than one connected record. In this case, the system will not be able to determine which connected record should be opened by clicking directly on the task link:
Could you please clarify your business task for further assistance?
Thank you beforehand!
Olga.
Olga Avis,
Thanks for the response.
Step 1 : I have an activity in my opportunity record.
(017 / Alpha Business / Package - Name of my opportunity record).
Step 2 : In that opportunity record - I'm changing the activity status of Test Activity to In Progress, i will get a reminder notification.
Step 3 : In the Reminder Notification when i click on "Test Activity" link it should take me to the connected Opportunity record : 017 / Alpha Business / Package (or) the Current Opportunity Record Name should be displayed as link along with Test Activity and clicking on that record name it should take me to that record page.
Note : I need this without mouse hover
Please see the attached images for reference.
Bhoobalan Palanivelu,
As an example, but not a completed one I have created the logic that opens the opportunity page in case there is an opportunity connected to the activity, but in case there is no opportunity it does nothing. But there is another problem that this action opens a new tab with the start page in both cases and this action should be modified - we will also think on how it can be done. So here is the code of the replacing schema for the ActivityMiniPage:
define("ActivityMiniPage", ["ConfigurationConstants", "BusinessRuleModule", "BaseFiltersGenerateModule", "ProcessModuleUtilities", "EntityConnectionLinksUtilities", "ActivityDatesMixin", "MiniPageEntityConnectionsUtils", "MiniPageEditControlsGenerator", "MiniPageDatePeriodGenerator", "LookupQuickAddMixin", "css!ActivityMiniPageCSS", "ActivityTimezoneMixin", "css!ActivityTimezoneMixin" ], function(ConfigurationConstants, BusinessRuleModule, BaseFiltersGenerateModule, ProcessModuleUtilities) { return { entitySchemaName: "Activity", details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/, attributes: { /** * @inheritdoc BaseMiniPage#MiniPageModes * @override */ "MiniPageModes": { "value": [Terrasoft.ConfigurationEnums.CardOperation.VIEW, Terrasoft.ConfigurationEnums.CardOperation.ADD] } }, mixins: {}, methods: { cancelEditActivity: function(){ this.callParent(arguments); }, onOpenConnectedOpportunityClick: function() { var activeRow = this.get("Opportunity"); console.log(activeRow); if (activeRow) { var primaryId = activeRow; if (primaryId) { console.log(primaryId); var requestUrl = "http://o_drobina:4334/0/Nui/ViewModule.aspx#CardModuleV2/OpportunityPageV2/edit/" + primaryId.value; this.sandbox.publish("PushHistoryState", {hash: requestUrl, stateObj: {forceNotInChain: true}}); } } else { this.cancelEditActivity(); } } }, diff: /**SCHEMA_DIFF*/[ { "operation": "merge", "name": "TitleInViewMode", "parentName": "HeaderContainer", "propertyName": "items", "values": { "caption": {bindTo: "Resources.Strings.ViewModeTitleCaption"}, "itemType": Terrasoft.ViewItemType.HYPERLINK, "bindTo": "Title", click: {bindTo: "onOpenConnectedOpportunityClick"}, "visible": {"bindTo": "isViewMode"}, "isMiniPageModelItem": true, "classes": { } } } ]/**SCHEMA_DIFF*/ }; });
Also the "ViewModeTitleCaption" localizable string should be created. The main logic here is stored in the onOpenConnectedOpportunityClick method where http://o_drobina:4334 should be replaced with an actual link to the website. As a result once you see the activity mini page in view mode (when hovering a mouse to the activity title in notification panel) you can click on its title:
and this action will:
1) Open the connected opportunity in this tab
2) Will open another tab with the start page
3) In case there is no opportunity connected to the activity this action only opens another tab with the start page
Now I am thinking on how to prevent opening of a new tab and update you once I have any ideas. Also I think on overriding the onNotificationSubjectClick method from the BaseNotificationsSchema that is actualy called when clicking on the activity subject in the notification panel.
Best regards,
Oscar
Bhoobalan Palanivelu,
Please create a replacing schema for the "Notifications module" from the "NUI" package (ReminderNotificationsSchema) and add the following code into it:
define("ReminderNotificationsSchema", ["ReminderNotificationsSchemaResources", "ConfigurationConstants", "RemindingsUtilities","BaseNotificationsSchema"], function(resources, ConfigurationConstants, RemindingsUtilities,BaseNotificationsSchema) { return { entitySchemaName: "Reminding", attributes:{}, methods: { onOpenConnectedOpportunityClick: function() { var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "Activity" }); esq.addColumn("Opportunity.Id", "OpportunityId"); esq.addColumn("Id","Id"); esq.filters.addItem(esq.createColumnFilterWithParameter(3, "Id", this.get("SubjectId"))); esq.rowCount=1; esq.filters.addItem(esq.createColumnIsNotNullFilter("Opportunity.Id")); esq.getEntityCollection(function (result) { if (result.success && result.collection.getCount() > 0) { var item = result.collection.getByIndex(0); var oppId = item.get("OpportunityId"); var requestUrl = "http://o_drobina:4334/0/Nui/ViewModule.aspx#CardModuleV2/OpportunityPageV2/edit/" + oppId; this.sandbox.publish("PushHistoryState", { hash: requestUrl }); } else { var schemaName = this.get("SchemaName"); var entityId = this.get("SubjectId"); var loaderName = this.get("LoaderName"); this.openNotificationEntityCard(schemaName, entityId, loaderName); } }, this); } }, diff: [ { "operation": "merge", "name": "NotificationActivitySubject", "values": { "itemType": Terrasoft.ViewItemType.HYPERLINK, "caption": {"bindTo": "getNotificationSubjectCaption"}, "click": {"bindTo": "onOpenConnectedOpportunityClick"}, "linkMouseOver": {"bindTo": "linkMouseOver"}, "classes": {"labelClass": ["subject-text-labelClass", "label-link", "label-url"]} } } ] }; });
Please also replace the http://o_drobina:4334 website address with an actual URL for your website. This code will make the opportunity to be opened in the same tab in case the reminder for the activity has an opportunity and it will also open an activity in case there is no opportunity for the activity once the subject of the activity is clicked.
Best regards,
Oscar
Oscar Dylan,
Thanks!
This works perfect.
Few clarfifcations,
1.where/which schema i could find the method of linkMouseOver
"linkMouseOver": {"bindTo": "linkMouseOver"},
2.An activity may be connected to more than one record.
on mouse Hover it will display all the connected records. How could i display all the connected records as hyperlink side by side along the Activity name.
I have attached a Screenshot for the reference.
Thanks in advance.
Bhoobalan Palanivelu,
linkMouseOver method is located in the application core and modifying this method is not possible.
Your second question requires more additional development and it would be better to use a standard view mini page instead of displaying all the related records in the reminding record itself, but I will think on how to achieve this task.
Best regards,
Oscar
Oscar Dylan,
Thanks much!
I have implemented the same as you suggested.
Requesting an additional insight.
Step 1 : If Activity triggered from opportunity we will get the notification with task name once user clicks on task name it is opening that perticular record.
Step 2 : If an Activity is triggered from 5 different opportunity record then how can we know which opportunity it belongs to. Because it displays only activity name in Reminder notification.
Step 3 : Is it possible to display the name of opportunity along with Activity name as hyper link and on click it should take to its opportunity record page.
I have attached the screenshot for reference.
Thanks in advance.
Bhoobalan Palanivelu,
I tried applying changes to the Reminder schema so to add an opportunity column to the
NotificationActivityItemContainer, but it is not as easy as it seems. It is easier and faster to create a custom notification for the opportunity directly using this article
https://academy.creatio.com/documents/technic-sdk/7-16/how-create-custo…. Please use this approach instead.
Best regards,
Oscar