- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 06:12 AM
@jaheerhattiwale
Hi All,
On incident form we have fields called caller Company and Department. And also Manager company and Manager Department fields.
- Case 1 : when the user tries to select the Manager company is not same as caller company then I want to show an error message Like "Manager company should be same as caller company" .If same is selected then the error message should be cleared. For that written g_form.ClearMessages() in onchange client script.
For that I have written an on change client script which is working as expected
Case 2 : when the user tries to select the Manager Department is not same as caller Department then I want to show an error message Like "Manager Department should be same as caller Department" .If same is selected then the error message should be cleared. For that written g_form.ClearMessages() in onchange client script.
For that I have written an another on change client script which is working as expected.
Here I am facing a challenge with the error messages. Whenever manager company and caller company is same then only the error message should be cleared.
But here When the user is selected the manager company is same as the caller company then the error messages are cleared along with error message of another on-change script of manager Department error message also getting cleared but it won't be cleared until user math the caller Department with manager Department. Vise vera.
How we can overcome this issue please help me on this.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 06:52 AM
Hi @Yasin Shaik11 ,
I''m considering that you are using two OnChange client scripts, one for ManagerCompany and one for ManagerDepartment. Modify both the scripts by including both the conditions in both the client scripts.
Refer the below code and modify with your fieldNames:
if(ManagerCompany == CallerCompany && ManagerDepartment == CallerDepartment){
g_form.ClearMessages(); }
else if(ManagerCompany == CallerCompany && ManagerDepartment != Caller Department){
g_form.ClearMessages();
g_form.addErrorMessage("Manager Department should be same as caller Department");
}
else if(ManagerCompany != CallerCompany && ManagerDepartment == Caller Department){
g_form.ClearMessages();
g_form.addErrorMessage("Manager company should be same as caller company");
}
I hope this helps. Mark my answer correct & Like Helpful, if Applicable.
Thanks!
Venkatesh Nekkanti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 06:52 AM
Hi @Yasin Shaik11 ,
I''m considering that you are using two OnChange client scripts, one for ManagerCompany and one for ManagerDepartment. Modify both the scripts by including both the conditions in both the client scripts.
Refer the below code and modify with your fieldNames:
if(ManagerCompany == CallerCompany && ManagerDepartment == CallerDepartment){
g_form.ClearMessages(); }
else if(ManagerCompany == CallerCompany && ManagerDepartment != Caller Department){
g_form.ClearMessages();
g_form.addErrorMessage("Manager Department should be same as caller Department");
}
else if(ManagerCompany != CallerCompany && ManagerDepartment == Caller Department){
g_form.ClearMessages();
g_form.addErrorMessage("Manager company should be same as caller company");
}
I hope this helps. Mark my answer correct & Like Helpful, if Applicable.
Thanks!
Venkatesh Nekkanti