Lookup filter - reverse join

Hello,

I have a section called Applications which has an Owner field that points to contact lookup. The application section also has a field that points to Company Lookup. I also have a Company section. Inside this section there is a detail called Workers to which contacts are added.

 

I want to filter Owner lookup to show contacts who are added to the Workers detail of the company which is mapped to the Application. Please see below image. Can someone help with the lookup filter?

 

Like 0

Like

3 comments
Best reply

Shivani Lakshman,

 

Change the filter from "[UsrWorkers.UsrWorker].UsrAccount.Id" to "[UsrWorkers:UsrWorker].UsrAccount.Id"

 

My bad, I forgot that in reverse join it work using ":", for example :

[EntityCode:FieldCode]

 

and not [EntityCode.FieldCode]

 

regards,

 

Julien

Hi Shivani,

 

To filter your lookup you need to add this attribute in the application page :

attributes: {
    "Owner": {
        "dataValueType": Terrasoft.DataValueType.LOOKUP,
        "lookupListConfig": {
            "filters": [function() {
                var filters = Ext.create("Terrasoft.FilterGroup");
                filters.add("WorkInThisCompany", 
                    Terrasoft.createColumnFilterWithParameter(
                        Terrasoft.ComparisonType.EQUAL,
                        "[Workers:Worker].Company.Id",
                        this.get("Company").value
                    )
                );
                return filters;
            }]
        }
    }
}

Replace "Workers" by the object code of the workers detail.

 

FYI :

here is the filter breakdown :

"[WorkerObjectCode:WorkerFieldCodeInWorkers].CompanyFieldInWorkers.Id"

 

Watch out that all the codes correspond to your environment, for example, the workers object code can be "UsrWorkers" or whatever you defined it. Check it out in the advanced settings.

 

Kind regards,

 

Julien

Julien Gunther,

Thank you for your response. I tried your code but received the error 

Collection item with name [UsrWorkers not found.

 

 request data: {"rootSchemaName":"Contact","operationType":0,"includeProcessExecutionData":true,"filters":{"items":{"searchFilter":{"items":{"1f59bb71-8f5d-45ed-b4eb...

 

Looks like the system is trying to reach UsrWorkers from Contact table. This is the case with my requirement. There is no direct relation between the 2 tables. Would appreciate any suggestion!

 

Here is the code I used

"UsrOwner": {
        "dataValueType": Terrasoft.DataValueType.LOOKUP,
        "lookupListConfig": {
            "filters": [function() {
                var filters = Ext.create("Terrasoft.FilterGroup");
                filters.add("WorkInThisCompany", 
                    Terrasoft.createColumnFilterWithParameter(
                        Terrasoft.ComparisonType.EQUAL,
                        "[UsrWorkers.UsrWorker].UsrAccount.Id",
                        this.get("UsrAccount").value
                    )
                );
                return filters;
            }]
        }

 

Shivani Lakshman,

 

Change the filter from "[UsrWorkers.UsrWorker].UsrAccount.Id" to "[UsrWorkers:UsrWorker].UsrAccount.Id"

 

My bad, I forgot that in reverse join it work using ":", for example :

[EntityCode:FieldCode]

 

and not [EntityCode.FieldCode]

 

regards,

 

Julien

Show all comments