Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Show and Hide annotation onload client script throws error in Portal

abirakundu23
Giga Sage

Hi All,

We have created a onload client script for annotation show/hide on a sn_hr_core_task table.

But we get some error in portal , Please find the attached screenshots.

function onLoad() {
    //Type appropriate comment here, and begin script below
    if ((g_form.getValue('u_is_an_extension_granted1') == '1' || g_form.getValue('u_is_an_extension_granted1') == '2') && g_form.getValue('short_description') == 'Localisation date confirmation') {
        // Hide the annotation
        $('my_annotation').up().show();

    } else {
        // Show the annotation
        $('my_annotation').up().hide();
    }

}

19 REPLIES 19

Mohith Devatte
Tera Sage
Tera Sage

Hello @absnow ,

Try unchecking the check box "isolate script" and try to run the script again

please mark my answer correct if it helps you

I have uncheck box "isolating script" and again same error.

@absnow in the annotation configuration in the form layout do the below steps and use the below script and try 

<span id="my_annotation">Your annotation text</span>

find_real_file.png

 

@absnow make sure your id is my_annotation i just tried in my PDI and it hid the annotation