How to access Lookup values in ESQ and further compare it with other fields

Hi Team,

 

There is a requirement in which I have to verify a specific condition based on fields and lookup values on clicking the SAVE button. I am using ESQ in edit page schema while overriding asyncValidate method to achieve this. 

 

But, I am unable to figure out which commands can be used to get further field values of that lookup, and then compare it. For reference, here in my case, Contact lookup is on Custom section and I want to fetch Department value of it .

 

Thanks in Advance, Prashant Jha

Like 0

Like

4 comments

Hello, 

 

Please check the below Community post for an example of the implementation:

https://community.creatio.com/questions/actually-i-have-developed-code-…

 

Let us know in case of any questions. 

Best regards,

Anastasiia

Hi Anastasiia,

 

How can we fetch columns of other object through ESQ by matching them with a condition. Any example or syntax will be helpful.

Prashant Jha,

Hi, take a look at this article, I believe this is what you needed.

In any case, you can use another ESQ request based on the values you got from the previous one.

Hi, I am overriding asyncValidate method with multiple filters (A AND C) AND (B AND C). Here C is the field from the same object, A and B are the fields from other object using ESQ.

 

I have created a separate function to achieve this as below :

 

ConditionCheck : function(ID, BUnit, esq)

            {

                

            var esqFirstFilter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Id",ID);

            var esqSecondFilter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL,"Department.Name",BUnit);

            

             esq.filters.logicalOperation = Terrasoft.LogicalOperatorType.AND;

            

            

                     esq.filters.add("esqFirstFilter",esqFirstFilter);

                     esq.filters.add("esqSecondFilter",esqSecondFilter);

                

                esq.getEntity(function(result)

                              {

                    if(!result.success)

                        {

                            this.showInformationDialog("Error");

                            return false;

                        }

                    return true;

                },this);

            },

 

And, I have used this function to call (A AND C) and (B AND C) separately as:

 

var result1 = this.ConditionCheck (A, C, esq);

var result2 = this.ConditionCheck (B, C, esq);

 

Now, I am not sure how we can combine the result1 and result2 in asyncValidate method such that it will only going to save when both result1 and result2 holds "true". Please help me on this.

Show all comments