hide/show subcategory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 10:08 PM - edited 04-09-2023 10:11 PM
Hello Everyone,
I have worked on a client script where if i select category then subcaegory field is populated.
However when the incident is saved the subcategory field gets hidden again.
How should i keep it on the screen after saving/submit.
For more info i have attached the screen shot and the code of my script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
g_form.setDisplay('subcategory', false);
return;
}
var val = g_form.getValue('category');
if (val == "incident_outage" || val == "inquiry") {
g_form.setDisplay('subcategory', true);
} else {
g_form.setDisplay('subcategory', false);
}
}
The image 2 shows the subcategory before saving however once this incident gets saved then subcategory is hidden as in image 1.
Please guide.
Thanks in Advance,
Renu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2023 10:27 PM - edited 04-09-2023 10:56 PM
Hi @Renu4 ,
What is the dictionary configuration of the sub category field, is it hidden by default?
If it is hidden by default, try writing an onLoad client script which should check if the sub category field contains a value or not, if value is present setDisplay to true otherwise set it to false.
OR
You can also use a UI Policy to get this.
Example onLoad client script:
function onLoad() {
//Type appropriate comment here, and begin script below
var sub_cat = g_form.getValue('sub_category');
if(sub_cat){
g_form.setDisplay('sub_category', true);
}
}
You can further modify this onLoad client script to include other conditions too.
Thanks,
Anvesh
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2023 12:27 AM
This works for me but what about when the ticket is submitted?the field disappears on the ticket saving.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2023 01:56 AM
Hello @Renu4
Did you checked may be there are some other client script written for it onSubmit or may be a ui policy is already there so please check if there are any such existing script written
Please mark my answer correct and helpful if it helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-10-2023 02:19 AM
@Renu4 ,
There must be some client scripts or UI Action which is hiding this field, check for that.
Thanks,
Anvesh
Anvesh