Question

Adding tile message to timeline attachment tile

I need to add the attachment 'Description' (the 'Notes' field of the attachment file 'OpportunityFile') to the Timeline tile for an attachment (Opportunities section).  I'm probably missing a step out, but if somebody can clarify this for me it would be much appreciated:

 

1) The Data for key 'OpportunityPageV2' of 'TimelinePageSetting':

select
"Key",
encode("Data",'escape') as "Data"
from "TimelinePageSetting"
    {
        "entityConfigKey":"59de07a7-28dd-4dc9-a106-a07cb9981423",
        "entitySchemaName":"OpportunityFile",
        "typeColumnName":"Type",
        "typeColumnValue":"529bc2f8-0ee0-df11-971b-001d60e938c6",
        "referenceColumnName":"Opportunity",
        "masterRecordColumnName":"Id"
    },

2) The edited entry for Id '59de07a7-28dd-4dc9-a106-a07cb9981423' of 'TimelineTileSetting':

select
"Id", 
"Name", 
encode("Data", 'escape') as "Data"
from "TimelineTileSetting"
{
    "typeColumnValue":"529bc2f8-0ee0-df11-971b-001d60e938c6",
    "entitySchemaName":"##ReferenceSchemaName##File",
    "viewModelClassName":"Terrasoft.FileTimelineItemViewModel",
    "viewClassName":"Terrasoft.UsrFileTimelineItemView",
    "orderColumnName":"CreatedOn",
    "authorColumnName":"CreatedBy",
    "captionColumnName":"Name",
    "messageColumnName":"Notes"
}

3) 'UsrFileTimelineItemView' is a new Module with source code copied from 'FileTimelineItemView' with the addition of the 'getMessageViewConfig' method copied from the example (note I am using the original viewModelClassName 'FileTimelineItemViewModel'):

 define("UsrFileTimelineItemView", ["BaseTimelineItemView"], function() {
	/**
	 * @class Terrasoft.configuration.FileTimelineItemView
	 * File timeline item view class.
	 */
	Ext.define("Terrasoft.configuration.UsrFileTimelineItemView", {
		extend: "Terrasoft.BaseTimelineItemView",
		alternateClassName: "Terrasoft.UsrFileTimelineItemView",
 
		// region Methods: Protected
 
		/**
		 * Returns file type icon view config.
		 * @protected
		 * @return {Object}
		 */
		getFileTypeIconConfig: function() {
			return {
				"name": "FileTypeIcon",
				"itemType": Terrasoft.ViewItemType.IMAGE,
				"getSrcMethod": "FileTypeSrc",
				"generator": "ImageCustomGeneratorV2.generateSimpleCustomImage",
				"onPhotoChange": Terrasoft.emptyFn,
				"classes": {
					"wrapClass": ["timeline-item-file-type-icon"]
				}
			};
		},
 
		/**
		 * Returns file preview image view config.
		 * @protected
		 * @return {Object}
		 */
		getFilePreviewImageConfig: function() {
			return {
				"name": "FilePreviewImage",
				"itemType": Terrasoft.ViewItemType.IMAGE,
				"getSrcMethod": "getPreviewImageSrc",
				"generator": "ImageCustomGeneratorV2.generateSimpleCustomImage",
				"onPhotoChange": Terrasoft.emptyFn,
				"classes": {
					"wrapClass": ["timeline-item-file-preview-image"]
				}
			};
		},
 
		/**
		 * @inheritdoc Terrasoft.BaseTimelineItemView#getCaptionViewConfig
		 * @protected
		 */
		getCaptionViewConfig: function() {
			var config = this.callParent(arguments);
			config.target = "_self";
			delete config.click;
			return config;
		},
 
		/**
		 * @inheritdoc Terrasoft.BaseTimelineItemView#getLeftHeaderViewConfig
		 * @protected
		 */
		getLeftHeaderViewConfig: function() {
			var leftHeaderConfig = this.callParent(arguments);
			leftHeaderConfig.items.splice(1, 0, this.getFileTypeIconConfig());
			return leftHeaderConfig;
		},
 
		/**
		 * @inheritdoc Terrasoft.BaseTimelineItemView#getBodyViewConfig
		 * @override
		 */
		getBodyViewConfig: function() {
			var bodyConfig = this.callParent(arguments);
			bodyConfig.controlConfig.visibilityHeight = 0;
			bodyConfig.visible = {
				"bindTo": "isFilePreviewImageVisible"
			};
			bodyConfig.items = [
				this.getFilePreviewImageConfig()
			];
			return bodyConfig;
		},
 
		// endregion
 
        // Redefined method returning the [Message] tile field configuration. 
        getMessageViewConfig: function() {
            // Receiving standard settings.
            var config = this.callParent(arguments);
            // Visibility setup. Visible if the tile is deployed.
            config.visible = {
                "bindTo": "IsExpanded"
            };
            return config;
        }
 
	});
});

 

Like 0

Like

1 comments

I have posted the solution to this here.

Show all comments