How to hide category and subcategory from incident form.

Gopal14
Tera Contributor

Hi Team,

 

How to hide category and subcategory from incident form. 

 

Need to show both fields once record is created in incident table.

4 REPLIES 4

SN_Learn
Kilo Patron
Kilo Patron

Hi @Gopal14 ,

 

Write an onload client script as below:

function onLoad() {
    if (g_form.isNewRecord()) {
        g_form.setVisible("category", false);
g_form.setVisible("subcategory", false);

    } else {
        g_form.setVisible("category", true);
g_form.setVisible("subcategory", true);
    }
}
----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Pratiksha2
Mega Sage

Hello @Gopal14 -


We can achieve this by using UI policy and Client script-

1. UI policy - Set the condition as State is new and make Category and subcategory visible false
2. Client Script - 

 

function onLoad() {
if(g_form.isNewRecord()){
            g_form.setVisible('category', true); // Enable Category field
            g_form.setVisible('subcategory', true); // Enable Subcategory field
        } else {
            g_form.setVisible('category', false); // disable Category field
            g_form.setVisible('subcategory', false); // disable Subcategory field
        }
}
    

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,

Pratiksha

Yashsvi
Kilo Sage

Hi @Gopal14,

please check below client script (onLoad):

 

function onLoad() {
    if (g_form.isNewRecord()) {
        g_form.setVisible("category", false);
g_form.setVisible("subcategory", false);

    } 
else 
    {
        g_form.setVisible("category", true);
        g_form.setVisible("subcategory", true);
    }
}

 

Thank you, please make helpful if you accept the solution.

Harish Bainsla
Tera Sage
Tera Sage

Hi @Gopal14 you can use on load client script I am sharing code below 

function onLoad() {
if (g_form.isNewRecord()) {

g_form.setDisplay('category', false);
g_form.setDisplay('subcategory', false);
} else {
 
g_form.setDisplay('category', true);
g_form.setDisplay('subcategory', true);
}
 
}
Screenshot 2024-07-23 at 12.17.27 PM.png
Screenshot 2024-07-23 at 12.15.14 PM.png