- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2024 09:48 AM
If subcategory is email or antivirus then service field must be hidden on incident form.How to achieve this using client script?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2024 10:29 AM - edited 02-18-2024 10:38 AM
@Shubham_verma write on change client script on subcategory field and use the below code snippet.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
return;
}
var subcategory = g_form.getValue('subcategory');
if (subcategory == 'email' || subcategory == 'antivirus') {
g_form.setDisplay('business_service', false);
} else {
g_form.setDisplay('business_service', true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2024 10:08 AM - edited 02-18-2024 10:20 AM
Hello @Shubham_verma,
To achieve this, you can use a UI Policy. Here are the steps:
- Create a UI policy on the table where you want this logic to be applied (I believe it's the Incident table).
- Provide a short description like "Hide Service when Subcategory is Email or Antivirus".
- In the condition field, select "Subcategory is Email" or "Subcategory is Antivirus".
- Save the UI policy form. You should see a related list.
- In the UI policy action related list, click "New" and select "Service" as the field.
- Set the visible to "False".
- Make sure to check "Reverse if false" and "OnLoad" checkboxes while creating the UI Policy.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2024 10:09 AM
I want to achieve this using client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2024 10:29 AM - edited 02-18-2024 10:38 AM
@Shubham_verma write on change client script on subcategory field and use the below code snippet.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (newValue === '') {
return;
}
var subcategory = g_form.getValue('subcategory');
if (subcategory == 'email' || subcategory == 'antivirus') {
g_form.setDisplay('business_service', false);
} else {
g_form.setDisplay('business_service', true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2024 10:36 AM
It worked.Thanks