hide/show subcategory

Renu4
Tera Contributor

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.

 

aftersubmit.PNGbeforesubmit.PNG

 

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.

6 REPLIES 6

Ranjit Nimbalk1
Tera Contributor

Hi @Renu4 ,

 

This can be achieved by UI policy.

Create a UI policy:-

1. When to apply- category is one of incident_outage, inquiry.

2. UI policy action- subcategory set visible to false.

 

please mark solution as helpful.

Regards,

Ranjit Nimbalkar

 

ritu_saluja
Tera Expert

@Renu4  Did you checked may be there is an existing client script written on submit.
First of all check that otherwise you can achieve this via ui policy when to apply category is one of incident_outage, inquiry.
and in ui policy action set subcategory set visible to false.
Mark my answer correct if you find it helpful.