Is it possible to pass attributes from a page into a validator as a parameter for use in its logic? I'm trying to pass the Id of the record into an async validator which should then query the database for the record to check whether it is in a valid state to be saved, but I don't seem to be able to pass the attribute in as a parameter and it isn't available by default in the validator. I've tried the below:

					"LookupAttribute_sttlz00": {
						"modelConfig": {
							"path": "PDS.QualifyStatus"
						},
						"validators": {
							"LeadSoldValidator": {
								"type": "Usr.LeadSoldValidator",
								"params": {
									"leadId": "$Id"
								}
							}
						},
					},

But it just passes in the literal string "$Id" instead of the value of Id. I don't see anything about passing dynamic values into validators in the documentation.

Like 0

Like

0 comments
Show all comments

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

Hi Community,

 

In Edit Page, there is asyncValidate method which validates the record asynchronously before saving. Now I want the same on deleting of records on detail. Is there any asyncValidate method on detail grid I can inherit? I want to perform asynchronous validation before deleting records on detail grid.

 

Thanks

Like 0

Like

1 comments

Hi Fulgen, 



There is no possibility to call validation since records being deleted throughout the detail's grid, not the object's page. 

But you can override methods of the mentioned grid and add your own logic into it. 

Please note that schema should also be added into custom BootstrapModulesV2 to upload it. 



Kind regards,

Roman

Show all comments