hiding annotation

samadam
Kilo Sage

I am using this script to hide annotation but not working. I have the annotation id set and get the alert printed but it doesnt hide. Any ideas on how to fix this?

function onLoad() {
    // Check if it's a new record
    if (g_form.isNewRecord()) {
        alert("in script");
        $('acq_msg').up().hide();
    } else{
        $('acq_msg').up().show();
    }
}
4 REPLIES 4

Chaitanya ILCR
Mega Patron

Hi @samadam ,

make sure isolate script field is false for the client script

 

 

ChaitanyaILCR_0-1768325225778.png

 

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

SinghShailendra
Tera Contributor

Hi @samadam 
Please use code.

function onLoad() {
if (g_form.isNewRecord()) {
// Hide entire annotation section
g_form.setSectionDisplay('acq_msg_section', false);
}
}

Also, 
Isolate Script = FALSE in client script.

samadam
Kilo Sage

I have isolate script as false, same code works in another form. Not sure why this is not. 

samadam
Kilo Sage

Got it working using the OOB script mentioned here.

Show/Hide Annotation UI Policy not working - ServiceNow Community