Can we call Duplicate Rule form Client Side/Server Side

Hi All,

 

We created a new duplicated rule, it is working on first time record is created but it is not working on modifying the attribute we used in the rule on same record.

Note: We checked the check box "Use this rule on save".

 

Can we call the Duplicate rule from C# or Java script?

 

Regards,

Raviraja

Like 0

Like

3 comments
Best reply

Hello Raviraja,

If you want the records being checked for duplicates not only when it's created, but every time it's modified, please create Replacing Schema for Base Entity Page and paste the following into it:

define("BaseEntityPage", [], function(DeduplicationConstants) {
	return {
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		messages: {},
		mixins: {},
		methods: {
 
			/**
			 * @inheritdoc Terrasoft.BaseEntityPage#asyncValidate
			 * @overridden
			 */
			asyncValidate: function(callback, scope) {
				this.callParent([function(result) {
					if (result.success && this.get("PerformSearchOnSave")) {
						this.findOnSave(callback, scope);
					} else {
						callback.call(scope, result);
					}
				}, this]);
			},
		},
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
	};
});

Please note, that it wil start duplicate check for every page on every change(even in the fields that are not being checked by your rule). 

You can use it as is or modify it so it fits your business task better. 

Best regards,

Yurii. 

Hello Raviraja,

If you want the records being checked for duplicates not only when it's created, but every time it's modified, please create Replacing Schema for Base Entity Page and paste the following into it:

define("BaseEntityPage", [], function(DeduplicationConstants) {
	return {
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
		messages: {},
		mixins: {},
		methods: {
 
			/**
			 * @inheritdoc Terrasoft.BaseEntityPage#asyncValidate
			 * @overridden
			 */
			asyncValidate: function(callback, scope) {
				this.callParent([function(result) {
					if (result.success && this.get("PerformSearchOnSave")) {
						this.findOnSave(callback, scope);
					} else {
						callback.call(scope, result);
					}
				}, this]);
			},
		},
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/
	};
});

Please note, that it wil start duplicate check for every page on every change(even in the fields that are not being checked by your rule). 

You can use it as is or modify it so it fits your business task better. 

Best regards,

Yurii. 

Thanks for the reply Yurii,

 

Can we modify this for to rule only for the desired field?

Can't we call a specific rule from frontend script?

 

thanks!

Yedla Ravi Raja,

Since you replace Base Entity Page, all child schemas will also inherit the same behavior. 

If you'd like to call deduplication for specific pages please add this method to the page you need. 

Also, this method calls the search itself, not specifying the rules.  

Best regards, 

Yurii

Show all comments