filter contact list in Section Actions Dashboard

Hi,

 

I need to filter contact list that is displayed when logging a call activity through Section Actions Dashboard. Below is the code I have added for the same:

1. Replaced CallMessagePublisherPage

 define("CallMessagePublisherPage", ["ConfigurationConstants"],
	function(ConfigurationConstants) {
		return {
			entitySchemaName: "Activity",
			mixins: {},
			attributes: {
				"Contact": {
					"lookupListConfig": {
						"columns": ["Account"],
						"filters": [
							function() {
									var config = this.getListenerRecordData();
									var additionalInfo = config.additionalInfo;
									var account=additionalInfo.account.value;
									var filterGroup = Ext.create("Terrasoft.FilterGroup");
									if(account){
									filterGroup.add("ContactFilter",
										Terrasoft.createColumnFilterWithParameter(
											Terrasoft.ComparisonType.EQUAL,
											"Account",
											account,
											Terrasoft.DataValueType.LOOKUP)
											);
									}
									return filterGroup;
							}
							]
					}
				}
			},
			methods: {
						setDefaultCallDirection: function() {
							var query = this.Ext.create("Terrasoft.EntitySchemaQuery", {
								rootSchemaName: "CallDirection"
							});
							query.addColumn("Name");
							var recordId = ConfigurationConstants.Activity.ActivityCallDirection.Outgoing;
							query.getEntity(recordId, function(result) {
								this.setDefaultCallDirectionQueryHandler(result);
							}, this);
						}
					},
			diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
		};
	}
);

 

2. Replaced SectionActionsDashboard

  define("SectionActionsDashboard", ["SectionActionsDashboardResources"], function(resources) {
    return {
        methods: {
				onGetRecordInfoForPublisher: function() {
					var info = this.callParent(arguments);
					info.additionalInfo.account = this.getAccountEntityParameterValue(info.relationSchemaName);
					return info;
				},
				getAccountEntityParameterValue:function(relationSchemaName){
					switch(relationSchemaName){
						case "Lead":
							return this.getMasterEntityParameterValue("QualifiedAccount");
						case "Contact":
						case "Opportunity":
						case "Order":
							return this.getMasterEntityParameterValue("Account");
						case "Account":
							return {"value":this.getMasterEntityParameterValue("Id")};
						default:
							return {};
					}
 
				}
		}
    };
});

With above code, I get the below result in Account section when I open the window to select contact.

Above is the expected result. But when typing in the name on the lookup field instead of opening the selection window all contacts that match the text are displayed(not filtered by Account)

Any idea how to apply the same filter when pulling the list by typing in the lookup field?

 

Like 0

Like

2 comments
Best reply

Hi,

 

Please also add the following method to the CallMessagePublisherPage:

getLookupQuery: function(filterValue, columnName) {
					var esq = this.callParent(arguments);
					var filterGroup = this.getLookupQueryFilters(columnName);
					esq.filters.addItem(filterGroup);
					return esq;
				},

and refresh the page after that. This should result in the needed filtration in the list view of the lookup.

Hi,

 

Please also add the following method to the CallMessagePublisherPage:

getLookupQuery: function(filterValue, columnName) {
					var esq = this.callParent(arguments);
					var filterGroup = this.getLookupQueryFilters(columnName);
					esq.filters.addItem(filterGroup);
					return esq;
				},

and refresh the page after that. This should result in the needed filtration in the list view of the lookup.

That works, thank you!

Show all comments