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.

Hide Additional comments field on Incident form

Jp41
Kilo Contributor

Hi,

I'm trying to create a script that hides the additional comments field if the user is not the same as "assigned to" can anyone help me?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use onLoad client script on incident table

function onLoad(){
	
	if(g_form.getValue('assigned_to') != g_user.userID)
		g_form.setVisible('comments', false);
	
}

Regards
Ankur

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use onLoad client script on incident table

function onLoad(){
	
	if(g_form.getValue('assigned_to') != g_user.userID)
		g_form.setVisible('comments', false);
	
}

Regards
Ankur

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

Thank you soooooo much, i just changed the setVisible function for SetReadOnly ❤️