Hiding Annotation on form while record is being created, then unhiding once it's created

Winston
Tera Guru

Hey everyone, 

I have an Annotation message that pretty much just tells the user to use a related list after the record is created, but i'm trying to hide it on the form until AFTER it's created. 

Here's what I got so far:

I made an HTML Annotation and gave it the id of "additional_ci"

find_real_file.png

Here's the script:

<span id="additional_ci">Please view the "Affected CIs" related list located at 
the bottom of this form to see the full list of affected CIs.</span>

I'm trying to hide the the Annotation in an onLoad client script:

I'm using g_form.isNewRecord() to show if the form is not created yet, and this works for me in other client scripts but isn't working for me here. What am I doing wrong?

find_real_file.png

Here's the script:

function onLoad() {
	// Hide annotation if the change record is new
	if(g_form.isNewRecord()){  
		// Hide the annotation
		$('additional_ci').up().hide();
	}
	else {
		// Show the annotation
		$('additional_ci').up().show();
	}
}
1 ACCEPTED SOLUTION

Willem
Giga Sage
Giga Sage

Can you check if "Isolate script" is set to false? You might have to add the field to the Client script form.

View solution in original post

5 REPLIES 5

@Winston 

Glad that my solution helped you.

Do remember to mark the post that helped you as helpful.

Have a nice day ahead..!!

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader