Can we Save an Assessment without answering the Mandatory Questions?

debendudas
Mega Sage

I am having an Assessment where multiple Mandatory and Non-mandatory Questions are present. When I try to Save the Assessment without answering all the Mandatory questions it is throwing an error as below:

debendudas_0-1740122463448.png


As per my understanding we cant's save the Assessment without answering all the Mandatory fields but if you know a way to Save the Assessment without answering all the Mandatory questions, please provide an answer.

 

Here is the full Assessment form:

debendudas_1-1740122597764.png

 

5 REPLIES 5

Mark Manders
Mega Patron

This question doesn't really make sense, right? It's the same as creating an incident without selecting impact and urgency. The fields are mandatory, so they need to be filled. If it needs to be saved without filling in, don't make them mandatory. On certain question types you can get around it through 'allow non applicable', so you can select n/a instead of a value, but not on all types. 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Yeah, the thing is supposed I need to complete an Assessment, in assessment there can be 10 mandatory questions, but I only know answers of 5 of them, I need to check with my other team members for the remaining answers. In Assessment there are 2 buttons available "Save" and "Submit", I want to Save my existing answers which I have already provided so that I don't have to fill them again when I will come back to the Assessment after checking with my team members for the remaining answers.

Implement a workaround. Put in an 11th question that is 'Have you filled in all questions'. If yes, make all questions mandatory, so they have to be filled in before you can submit. If no, you can just save it, because the questions aren't mandatory.

 

Do check on the requirement for this assessment in itself. If you need to answer the questions, you should be able to do so, without having to ask others.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

blaze1
Tera Contributor

To allow users to save the assessment without answering all mandatory questions, you can implement a **Save as Draft** functionality.

1. UI Action Configuration
You can create a single UI Action that both saves the assessment as a draft and handles the form save action.

Steps:
Go to: System UI > UI Actions.
Click New to create a new UI Action.
Set the following fields:
Name: Save as Draft
Table: Select your assessment table (e.g., assessment).
Action Name: save_as_draft
Form Button: Checked (This makes the button visible on the form).
Condition: true (or any specific condition to show the button).
Active: Checked
Script: Paste the simplified script below.
2. Simplified Script for the UI Action

// When the user clicks on the "Save as Draft" button, save the assessment as draft.
(function executeAction() {
var gr = new GlideRecord('your_assessment_table'); // Replace with the correct table name
if (gr.get(g_form.getUniqueValue())) {
gr.state = 'draft'; // Set state to 'draft' (or another state for draft)
gr.update(); // Save the record as draft

g_form.save(); // Save the form with any changes

// Inform the user that the record is saved as a draft
g_form.addInfoMessage('Assessment saved as a draft. You can complete it later.');
} else {
g_form.addErrorMessage('Error saving the assessment as a draft.');
}
})();

3. Explanation of the Script
gr.state = 'draft';: Sets the state of the assessment to "draft" (you can change this to any state that suits your process).
g_form.save();: Saves the form's current state and any changes made by the user.
g_form.addInfoMessage('Assessment saved as a draft. You can complete it later.');: Displays a message to the user that the assessment has been saved as a draft.
Error handling: If the record cannot be retrieved, an error message is shown.
4. UI Action Configuration - Full View
Name: Save as Draft Table: your_assessment_table (select the correct table for your form) Action Name: save_as_draft Form Button: Checked Active: Checked Condition: true (or other conditions if necessary)

5. Final Notes
This solution provides a way for users to save their assessment as a draft, complete with a UI action button for easy access. Let me know if you need further details!

Blaze Llanos, USMC, MISM
ServiceNow Engineer
Solutions: IT | ServiceNow Expertise Transforming Challenges into Solutions
LinkedIn: https://www.linkedin.com/in/blazellanos/