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.

OOTB Save button - How to ignore mandatory fields

Annette Kitzmil
Tera Guru

Hello,

So I have an OOTB Save button that we do want to use.  However, the one caveat is not requiring the mandatory fields when it is clicked.  I have two fields that are not required at the dictionary level, but are set to mandatory in a client script that is part of a UI Action only. 

 

However, when the Save button is getting clicked it is requiring those 2 fields to be completed.  This is a scoped app using workspace.  Are there any suggestions on how I can avoid this when using the OOTB Save button.

 

Thanks,

Annette

3 REPLIES 3

Kieran3
Tera Contributor

Hi @Annette Kitzmil 

 

You'd need to those fields to not be mandatory. The functionality is acting exactly how it should as per the client script. Unfortunately there is no way (or at least no easy way) to circumvent this and it isn't advised because it would be creating a different UX for that workspace compared to the rest of the platform.

lauri457
Giga Sage

It seems like you don't need those fields to be mandatory? Seems more of a process issue than something you should configure. Consider alternate views for users/scenarios where they don't need to be mandatory or review the client script.

 

It can be achieved with a custom ui action

function save() {
	g_form.setMandatory("caller_id", false);
	if (!gsftSubmit(null, g_form.getFormElement(), "save_remove_mandatory")) {
		g_form.setMandatory("caller_id", true);
	}
}

 

mugi-san
Tera Guru

Hi, @Annette Kitzmil .

Check [table mandatory] [Client Script] and [Data Policy Rule].

 

regards.