I have an error, when i save the formula, the validator won't let me save the changes. An error is written: "Formula value error: Parameter "NumberStyles" not found". I have added the necessary System.Globalization using for compilation.

How can I solve the validation problem without changing the business process code?

 

Like 0

Like

4 comments
Best reply

The problem has solved by disabling 'UseProcessFormulaServerValidation' feature

Hello!



Could you please provide us with connected namespace details to the process?

Alona Dolya,

 Hi! I'm using two namespaces System.Globalization and Terrasoft.Configuration.Disbursement, which has only three public classes and doesn't include name "NumberStyles".

I have observed the same problem on Demo site. System.Globalization had been added into namespaces of the process

The problem has solved by disabling 'UseProcessFormulaServerValidation' feature

Show all comments

Hello,

 

I want to add a phone validation to the "Other phone" and "Extension phone" fields in Communication options.

For Mobile phone I used the following code:

I want to do the same thing for the other 2, but I cannot find their objects anywhere?

 

Does anybody know how I can do this?

 

Thank you!

Like 0

Like

3 comments
Best reply

Hello,

 

"Other phone" and "Extension phone" are communication types only, not objects and their values are stored in the "ContactCommunication" table (actual number is stored in the "Number" column) with the correspondent "CommunicationTypeId" (Id correspondent values can be reviewed in the "CommunicationType" table). Also these communication types have no correspondent columns on the "Contact" enity side.

Hello,

 

"Other phone" and "Extension phone" are communication types only, not objects and their values are stored in the "ContactCommunication" table (actual number is stored in the "Number" column) with the correspondent "CommunicationTypeId" (Id correspondent values can be reviewed in the "CommunicationType" table). Also these communication types have no correspondent columns on the "Contact" enity side.

Oleg Drobina,

Thank you for your answer! Do you know what I can do to create a validation for these two? I created 2 fields in the Contact object and now I want to somehow connect them to the ones from Comunications.

Ghiu Diana Stefania,

 

In this case you need to create a logic similar to the one that is triggered when new communication option is added to the ContactCommunication object (see the logic in the SynchronizeCommunicationWithEntity method from the CommunicationSynchronizer source code). Alternatively you can try creating a custom business process that will update a main contact record in case new value was added to contact communication option.

Show all comments

I achieved Asynchronous Validation when I have One.  But How to implement asynchronous validation when I have multiple asynchronous validations to perform

Like 1

Like

5 comments
Best reply

Kavya,

I simplified the code from somewhere else and omitted an important part (the part that checks the previous validation functions result). I've updated the code in my original reply. Change yours like that and it should work. 

I've also written up the steps here as well: https://customerfx.com/article/validating-multiple-asynchronous-results…

Ryan

Hello,

 

Could you please describe your issue in more details?

Set up each validation as it's own function, something like this for each validation function: 

validateThing1: function(callback, scope) {
    var result = {
        success: true,
        message: ""
    };
 
    // do whatever async call to validate and then call below to return the result, 
    // setting result.success = true if validation passed or result.success = false 
    // if failed. If the validation failed, also set the message (will be displayed to user)
 
    callback.call(scope || this, result);
}

Then, in the asyncValidate, you'll use Terrasoft.chain to chain all the validations together, something like this (in this example I have two validation functions "validateThing1" and "validateThing2":

asyncValidate: function(callback, scope) {
    this.callParent([function(response) {
        if (!this.validateResponse(response)) {
            return;
        }
        Terrasoft.chain(
            function(next) {
                this.validateThing1(function(response) {
                    if (this.validateResponse(response)) {
                        next();
                    }
                }, this);
            },
            function(next) {
                this.validateThing2(function(response) {
                    if (this.validateResponse(response)) {
                        next();
                    }
                }, this);
            },
            function(next) {
                callback.call(scope, response);
                next();
        }, this);
    }, this]);
}

Ryan

Ryan Farley,

Hey Ryan , Thanks for the response,

I tried the same something like below but not able to achieve the target. Error Message is not coming and all records are saving which I ideally want to restrict from save as it is invalid,











 

asyncValidate: function(callback, scope) {

                this.callParent([function(response) {

                    if (!this.validateResponse(response)) {

                        return;

                    }

                    Terrasoft.chain(

                        this.startDateValueValidator,

                        this.CheckPreviousAppointment,

                        function(next) {

                            callback.call(scope, response);

                            next();

                    }, this);

                }, this]);

            },

            startDateValueValidator: function(callback, scope) { 

               var StartDate = this.get("StartDate");

              // this.set("StartDateChangeFlag",false);

               if (!StartDate) {

                        callback.call(scope, {

                            success: true

                        });

                    return;

                }

                if (!this.get("StartDateChangeFlag")) {

                    console.log("Skipppedddd Start Date Validator");

                    callback.call(scope, {

                            success: true

                        });

                   return;

                }

               console.log("Inside Start Date Validator");

               var today  = new Date();

              // today.setHours(0, 0, 0, 0);

               if(StartDate < today){

                    callback.call(scope || this, {

                                        success: false,

                                        message: "Start Date can't be Past."});

                 }    else{

                  console.log("Inside else part");

                   callback.call(scope || this, {

                            success: true

                        });

              }

            },

            CheckPreviousAppointment: function(callback, scope) {

               var MemberMapped = this.get("UsrUsrMember");

               var AppointmentStatus = this.get("Status");

               var startDate = this.get("StartDate");

                if (!MemberMapped) {

                    callback.call(scope || this, {

                            success: true

                        });

                    return;

                }

                console.log("Inside Member Validator");

                // create query for server side

                var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "Activity" });

                esq.addColumn("Id"); 

                esq.filters.addItem(

                    esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "UsrUsrMember", MemberMapped)

                );

                esq.filters.addItem(

                    esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Status", AppointmentStatus)

                );

                esq.filters.addItem(

                    esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "StartDate", startDate)

                );

                esq.getEntityCollection(function(response) {

                    if (response.success && response.collection) {

                        var items = response.collection.getItems();

                        if (items.length > 0) {

                            console.log("Length : --> "+items.length);

                            console.log("Inside Callback if");

                                callback.call(scope || this, {

                                    success: false,

                                    message: "Appointment is already booked. Kindly Cancel the previous to book new appointment"        

                                });

                        } else{

                            callback.call(scope || this, {

                                success: true

                            });

                        }

                    }

                }, this);

            },

Kavya,

I simplified the code from somewhere else and omitted an important part (the part that checks the previous validation functions result). I've updated the code in my original reply. Change yours like that and it should work. 

I've also written up the steps here as well: https://customerfx.com/article/validating-multiple-asynchronous-results…

Ryan

Is there any published methodology for doing this for async validation in Freedom UI?

Show all comments

Is it possible to change the Location of Validation message in Screen ? 

Please See the screenshot. I want to Change the place of the message from bottom to right as this message is covering the Bellow field's text.

Like 0

Like

1 comments

Hello,

 

Thank you for reporting this issue to us!

 

Unfortunately, the described behavior cannot be improved with a help of basic system tools as of now, but we have already registered a query for our responsible R&D team to improve this functionality in the upcoming releases of the main application. 



Thank you for helping us to make our application better!



Best regards,

Anastasiia

Show all comments

Hello,

 

I am willing to add a process for validation on Save for the Case object as shown in figure attached.

 

Any insights please?

 

Thanks,

Like 0

Like

1 comments

Hello,

 

The following instructions can help you to achieve the result you are looking for: validators schema section

 

Show all comments

How can I set such validations

1. The "Date To" of an event should come after the "Date From"

2. The date should not be in the past

3. The amount should not be less than 0

 

Like 1

Like

4 comments

Hello Arkadiusz Polus, in order to perform this kind of validation you need to write a little bit of code in the schema page. Perhaps this article of the academy will light things up for you. 

https://academy.creatio.com/docs/developer/getting_started/develop_appl…

what about business rules? 

Arkadiusz Polus,

Business rules do not permit these operators >, >=, <, <=, so it would not be possible to solve these three cases that you mentioned earlier.

 

Maybe something that should be included in business rules in the future ? ?

Show all comments

Hi Community,

 

I wanted to implement a funtionality where a validation should happen on click of Approve button. If the valiation fails the approval should not happen.

 

To achive the above task I tried with the following approaches, on the "UsrReturns" custom object.

  1. Tried to implement "asyncValidate" on "UsrReturnsVisaPageV2", but it didn't work (Seems the approval is happening outside the context of this page). Also not sure what is the use of this page.
  2. Tried to implement validation using Entity Events Layer on the object "UsrReturnsVisa". Although it didn't approve the request, but it didn't throw the exception as well with the following code,
    if(true){
    	throw new Exception("Can not approve");
    }
    return true;
  3. Tried to implement a custom approval logic using "ApprovalDashboardItemViewModel", but I can not create a replacing schema with this.

So need a way to implement such funtionality. Any suggestions will help.

 

Thanks & Regards,

Sourav Kumar Samal

Like 0

Like

3 comments

Hello,

 

Can you please screenshot the exact button you click, clicking which should start the validation process?

 

Thank you!

 

Best regards,

Oscar

Oscar Dylan,

While clicking Approve on notification panel as shown below,

 

 

Also while clicking under DCM & from Approvals section, same error shows on the console, but popup doesn't come.

 

Regards,

Sourav

Sourav Kumar Samal,

 

this is a bad request response returned by the app and we need to see the actual response (from the "Response" tab of the request in the "Network" tab).

 

To add some logic upon approval you need to replace the "approve" method in the "VisaNotificationsSchema" module (for "reject" actions its "reject" method). You will be in the context of the approval record and you can use data from there to process further with the approval\rejection. So you need to override the logic of these two methods.

 

Best regards,

Oscar

Show all comments

Hi Community,

 

I have follwed the following article to add a validation on attachment object using Entity Events Layer:

Article: https://community.creatio.com/questions/how-restrict-attachment-upload-specific-conditions

 

The above logic is working as expected when I am uploading files of small size (< 500 KB). But the issue happens when I try to upload larger files, the following popup appears instead of the custom exception.

 

Any suggestion how to resolve the issue for larger files?

 

Thanks,

Sourav Kumar Samal

Like 0

Like

2 comments

Hello,

 

The logic provided in the previous post doesn't depend on the file size (that is specified in the system setting with "MaxFileSize" code). Additionally it doesn't use file locator in it, it only uses values from the account object column and compare it to the current date and time. There should be another custom logic that generates this exception, something that is triggered when adding the file to the system and if the upload is restricted another logic stops its execution with this exception.

 

Best regards,

Oscar

Oscar Dylan,

 

I have added the following code:

 

		#region Methods: Public
 
		public override void OnFileSaving()
		{
			var ClaimId = Entity.GetTypedColumnValue&lt;Guid&gt;("ClaimsId");
			var ResultESQ = new EntitySchemaQuery(UserConnection.EntitySchemaManager, "Claims");
			ResultESQ.UseAdminRights = true;
			ResultESQ.AddColumn("Id");
			ResultESQ.AddColumn("ClaimStatus");
			var Result = ResultESQ.GetEntity(UserConnection, ClaimId);
			var DCMStatus = Result.GetTypedColumnValue&lt;Guid&gt;("ClaimStatusId").ToString();
 
			if(DCMStatus == "ff78a06e-9d37-474a-841c-32a8faaa7776" || DCMStatus == "13c42d45-0fb9-4854-9a5d-5a5feb126db2" || DCMStatus == "19226327-e2ff-420c-937e-c36949be4425"
				|| DCMStatus == "3adf1d1d-bc90-475b-b24b-ca837e9ca9fc"|| DCMStatus == "942af147-3fc9-4a80-89aa-76f0412e0ade"){
			    base.OnFileSaving();
			}else{
			    throw new Exception("Attachments can not be added as Claim is already Submitted.");
			}
		}
 
		#endregion

When the file size is small, the following popup is coming:

 

 

When the file size is large, the following popup comes up:

 

 

The above popup comes only when the above condition is met. We have not implemented any other logic for this object. Could you help us here with what might be the cause of the issue, when it is working fine with smaller files but not with larger files.

 

Thanks,

Sourav Kumar Samal

Show all comments

Hello Community,

 

I have a requirement, when a user changes the DCM status manually validation should trigger. To achieve this I am using asynValidate function and the validation is working fine.

But the issue here is status is not restoring back automatically and also both Save and Cancel button is showing as a result when I am trying to create a record in the connected detail the validation is triggering again. I have to manually click on Cancel before I can do any changes in the details. Please refer the screenshot below.

Before validation:

After validation:

 

Is there anyway after validation it should reset back to Close like in the 1st image?

 

Thanks,

Sourav Kumar Samal

Like 0

Like

4 comments
Best reply

Anastasiia Zhuravel,

 

I have resolved the issue. To acheive the desired output I have added a small line after the error message as follows:

			MandatoryValidation: function(callback, scope){
				var DCMstatus = this.get("MarketingPlansStatus").displayValue;
				if(DCMstatus === "Business Owner Review"){
					// Some query
                                        callback.call(scope || this, {
						success: false,
                                                message: "Error message"
					});
                                        this.reloadEntity();
				}else{
					callback.call(scope || this, {
						success: true
					});
				}
			},

Note: If the asynValidate is being used in this.NewMode(), avoid adding this.reloadEntity() as this may clear all the fields.

 

Thanks,

Sourav Kumar Samal

Hello, 

 

Could you please clarify how exactly the manually validation functionality has been achieved? Was it done by code?

 

Thank you in advance!

Best regards,

Anastasiia

Anastasiia Zhuravel,

 

Yes it has been achieved by using 'asyncValidate' function. The validation will only trigger when DCM status changed to "Business Owner Review".

 

Thanks,

Sourav

Anastasiia Zhuravel,

			asyncValidate: function(callback, scope) {
				if (this.isEditMode()){
					this.callParent([function(response) {
						if (!this.validateResponse(response)) {
							return;
						}
						Terrasoft.chain(
							function(next) {
								this.MandatoryValidation(function(response) {
									if (this.validateResponse(response)) {
										next();
									}
								}, this);
							},
							function(next) {
								callback.call(scope, response);
								next();
							}, this);
					}, this]);
				}else {
					this.callParent(arguments);
				}
			},
			MandatoryValidation: function(callback, scope){
				var DCMstatus = this.get("MarketingPlansStatus").displayValue;
				if(DCMstatus === "Business Owner Review"){
					// Some query
                                        callback.call(scope || this, {
						success: false,
                                                message: "Error message"
					});
				}else{
					callback.call(scope || this, {
						success: true
					});
				}
			},

 

Anastasiia Zhuravel,

 

I have resolved the issue. To acheive the desired output I have added a small line after the error message as follows:

			MandatoryValidation: function(callback, scope){
				var DCMstatus = this.get("MarketingPlansStatus").displayValue;
				if(DCMstatus === "Business Owner Review"){
					// Some query
                                        callback.call(scope || this, {
						success: false,
                                                message: "Error message"
					});
                                        this.reloadEntity();
				}else{
					callback.call(scope || this, {
						success: true
					});
				}
			},

Note: If the asynValidate is being used in this.NewMode(), avoid adding this.reloadEntity() as this may clear all the fields.

 

Thanks,

Sourav Kumar Samal

Show all comments

Is it possible to add validation code to the client module of a pre-configured page (i.e. in the same way you would an edit page)?

Like 0

Like

1 comments

Hi Gareth, 

 

In this case, we are suggesting using Business processes for such implementation. 

 

https://academy.creatio.com/docs/7-17/user/bpm_tools/process_elements_r…

 

https://academy.creatio.com/docs/user/bpm_tools/dynamic_case_setup/case…

 

This element will generate the code itself and you don't need to change the Schema manually, which will be much complicated and could potentially affect the whole page.

 

Best Regards, 

 

Bogdan L.

 

 

 

Show all comments