Show and Hide annotation onload client script throws error in Portal

abirakundu23
Mega 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

@absnow did this work ?

if yes please close the thread by marking the answer correct if not let me know

thanks

Hi @Mohith Devatte ,

Annotation show/hide working fine, but these script throws error in service portal as per attached screenshot. java script error. I have uncheck "isolate script" option but still it is showing.

Aman Kumar S
Kilo Patron

You are using DOM manipulation, make sure your client script has "Isolate script" check box as false on the client script form.

If the field doesn't exist on the form, you can configure form layout to bring the field on the form and set the value as false.

Best Regards
Aman Kumar

Hi Aman.

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

Open the form in a new window and try to test it again, make sure your name of the annotation is correct.

This is correct syntax to show and hide annotation, what is the new error you are getting?

Best Regards
Aman Kumar