Not able to save business rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2024 10:06 PM
Error MessageonSubmit script error: TypeError: Cannot read properties of undefined (reading 'replace'):
function onTemplateFieldSubmit() {
var allowMultipleCarets = false;
var CaretValidationError = function(message) {
this.message = message;
};
var validationFunc = function(stringVal) {
if(stringVal.match(/\^\^/))
throw new CaretValidationError(getMessage("Your template contains an invalid character sequence: multiple carets"));
};
try {
var cfilter = getFilter(fname, true, allowMultipleCarets ? null : validationFunc);
} catch (err) {
if (err instanceof CaretValidationError) {
g_form.addInfoMessage(err.message);
return false;
}
}
cfilter = cfilter.replace(/\^NQ/g, "^");
hinput.value = decodeURIComponent(cfilter);
CustomEvent.fire("sys_mapping:on_cond_submit::" + fname, { value: hinput.value, ref: fname });
}
This error I'm getting

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2024 10:29 PM
Hi,
Are you facing this issue on PDI or customer instance?
Have you tried creating or updating any other BR? Is it happening for all record?
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2024 10:53 PM
Hello @Saroj Patel ,
Please give a try to the script below and let me know how it works for you , also give feedback on the questions which are asked by @Anil Lande , so that it could help us to resolve your issue.
function onTemplateFieldSubmit() {
var allowMultipleCarets = false;
var CaretValidationError = function(message) {
this.message = message;
};
var validationFunc = function(stringVal) {
if (stringVal.match(/\^\^/)) {
throw new CaretValidationError("Your template contains an invalid character sequence: multiple carets");
}
};
try {
var cfilter = getFilter(fname, true, allowMultipleCarets ? null : validationFunc);
// Check if cfilter is undefined before attempting to replace
if (cfilter !== undefined) {
cfilter = cfilter.replace(/\^NQ/g, "^");
// Assuming hinput is defined somewhere in your code
if (hinput !== undefined && hinput.value !== undefined) {
hinput.value = decodeURIComponent(cfilter);
CustomEvent.fire("sys_mapping:on_cond_submit::" + fname, { value: hinput.value, ref: fname });
} else {
console.error("hinput is undefined or hinput.value is undefined");
}
} else {
console.error("cfilter is undefined");
}
} catch (err) {
if (err instanceof CaretValidationError) {
g_form.addInfoMessage(err.message);
return false;
} else {
console.error("Unexpected error:", err);
}
}
Let me know your views on this and Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Aniket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 04:47 AM - edited 01-15-2024 05:50 AM
Hello @Saroj Patel ,
Previously I didn't understood your issue properly but accidently today I also faced the same issue while working, like I was also not able to save or change anything in business rule
Then I just logged in to my instance in "Incognito window" and tried to save the same business rule record and at that I time I didn't faced any issue, but at the same time I am currently still facing the issue in normal chrome window and I have tried to log out and again login, cleared the cache.
but for a time being you can use the Incognito mode to work and make changes, till then I will try and fix the issue and let you know about further updates
Let me know your views on this and Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks,
Aniket

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 05:23 AM
@Aniket Chavan are you facing on PDI?
Thanks
Anil Lande