The Zurich release has arrived! Interested in new features and functionalities? Click here for more

save record as draft without inputting mandatory fields

brendanwilson84
Kilo Guru

Hi Guys

I was wondering if any or you have come up with a solution to save a form as "draft" without having to complete the mandatory fields first?

Many thanks

5 REPLIES 5

Brad Tilton
ServiceNow Employee
ServiceNow Employee

Hi Brendan,



If you're talking about a table form like incident or problem, I would typically create a state choice of Draft and then have my ui or data policies look at that state and not make the fields mandatory until it had changed to something else. If you're talking about the service catalog there are some different methods people have tried and you can find them around on the community, there's not really one great method.


Hi Brad,



Thank you, sorry I should have mentioned that it was about a table. I will give your solution a go, thank you


Deepa Srivastav
Kilo Sage

Hi,



You can use checkMandatory is false..


You may find below link helpful.



How to disable all the mandatory fields using single function/command.


Re: Need to save Form without filling Mandatory fields


Saving a record without populating all mandatory variables


Saving records without populating mandatory fields in Geneva




Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.


Thanks,
Deepa


Nestor Padilla1
Giga Expert

You can create a UI Action that can bypass the mandatory fields and save the record.

Need to run it on the client-side, you can set it as a Related link or button or whatever and make it visible to specific roles or groups via conditions.

Here is the code

function override(){
	g_form.checkMandatory = false;
	gsftSubmit(null, g_form.getFormElement(), "save_watchlist"); //action name
}if (typeof window == 'undefined')
	setRedirect();function setRedirect() {
		current.update();
		action.setRedirectURL(current);
	}

 

You need to set the action name to "save_watchlist" without quotes or you can modify as needed.

In the conditions you can set stuff like, this button should be visible is Incident is not closed:

Condition: current.incident_state != IncidentState.CLOSED

or you can add more conditions:

current.incident_state != IncidentState.CLOSED  && gs.hasRole("itil") && (gs.getUser().isMemberOf('group name'))

This conditions states: incident should not be in closed state, user should have ITIL role, and should be member of a group named: group name

I hope this helps you find the solution.

Let me know if it helps and mark the answer as correct if so.

Best Regards,