Variable section

ashok17
Tera Contributor

Hi All,

Variable section should visible only if incident raised through service portal but If any user raise incident through Like All-->Incident--> create new the Variable section should not visible in incident form.

I have added in Section Incident Variable Editor in incident form design and written below client script for variable read-only this is working fine but If user raised incident using All-->Incident--> create new the variable section showing empty.

g_form.setVariablesReadOnly(true);

Please suggest for this requirement.

10 REPLIES 10

SANDEEP28
Mega Sage

@ashok17 Variable editor is a UI macro. Its not a field or section on the form which you can hide and show conditionally using client script or UI polict. I would suggest below steps

 

1) Create section on the incident for and add "Variable editor" into it.

2) Create client script to hide section itself  if any mandatory variable has empty value. In my case, "Urgency" is mandatory variable so I am using it in client script.

 

 

SANDEEP28_0-1704200209339.png

 

SANDEEP28_1-1704200241370.png

 

function onLoad() {
    //urgency is one of the mandatory variable, you can use any mandatory variable from your record producer
    if (g_form.getValue('current.variables.urgency') == null) { 
        g_form.setSectionDisplay('variables', false);
    }

}

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!