Make field mandatory after  submitting (incident)
						
					
					
				
			
		
	
			
	
	
	
	
	
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2022 01:41 AM
Hi All,
I have a field on the incident record that I want to make mandatory on form submitting.
I created a client script (onSubmit):
function onSubmit(){
g_form.setMandatory('field_name', true);
}
when I'm submitting it's turning to mandatory but after a few seconds the red asterisk disappears.
Does anyone know how to fix this?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2022 01:47 AM
Hi @Snow Tomcal ,
You can use onload client script as below. Change your field backend name
function onLoad() {
   //Type appropriate comment here, and begin script below
	if(!g_form.isNewRecord()){
		g_form.setMandatory('business_service',true);
	}
   
}Please Mark My Response as Correct/Helpful based on Impact
 Regards,
Gunjan Kiratkar
2X ServiceNow MVP 
Community Rising Star 2022
Youtube : ServiceNow Guy 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2022 02:47 AM
it's still doesn't work. the asterisk disappears.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2022 02:50 AM
Hi @Snow Tomcal ,
Check if there are any onload client script or UI policy present for that field. That might be causing issue.
Please Mark My Response as Correct/Helpful based on Impact
 Regards,
Gunjan Kiratkar
2X ServiceNow MVP 
Community Rising Star 2022
Youtube : ServiceNow Guy 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2022 02:59 AM
I didn't find one
