- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 01:36 AM
hi i have one case form. when i select integration as channel and account payable as category i need to hide one option from subcategory dropdown. how can i do it?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 06:07 AM
Can you confirm that "account_payable" is the actual value of that category and that "integration" is the actual value of that channel name?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 01:57 AM
Hi,
You can try an on change client script -
var channel = g_form.getValue('your field name');
var category = g_form.getValue('your field name');
if(channel == 'integration' && category == 'account payable') {
g_form.removeOption('subcategory', 'subcategory value');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 02:01 AM
on which field shall i put validation on my client script ? chanel or category?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 02:04 AM
Hi @Deepanshi1
You can write an onChange Client Script, set the field name to subcategory and use the following code-
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var channel = g_form.getValue('channel'); // Assuming 'channel' is the name of the Channel field
var category = g_form.getValue('category');
var subcategoryField = g_form.getControl('subcategory');
if (channel === 'Integration' && category === 'Account Payable') {
subcategoryField.removeOption('option_to_hide'); // Replace 'option_to_hide' with the value of the option you want to hide
}
}
Please mark my answer helpful and correct.
Regards,
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2024 02:10 AM
Good day,
The answer to this query will depend a little bit on your setup. But the general principles will be the same.
In general, you will want to use at least 1 Client Script. This Client Script will run on the Case table and have a type of "onChange" and point to your "Channel" field.
The code for your client script will look like this...
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == "integration" && g_form.getValue("category") == "account_payable") {
g_form.removeOption('subcategory','option_to_remove');
} else {
g_form.addOption('subcategory','option_value', 'option_label');
}
}
This will now hide the "option_to_remove" option from your "Subcategory" field when the "Channel" field is changed to "Integration".
However, depending on your setup, it may be possible for users change the "Subcategory" field after they have submitted the form. So you may want to create a Client Script that runs onLoad with the following code...
function onLoad() {
if (g_form.getValue("contact_type") == "phone" && g_form.getValue("category") == "inquiry") {
g_form.removeOption('subcategory','option_to_remove');
}
}
Please note I am using "contact_type" above because this is the value of the "Channel" field on my PDI. You may want to double check this in your instance.
If this helped solve your query. Please mark it as the solution. It really helps me out. If it was in any way useful, please mark it as useful!