mandatory field edits not kicking in

cdgaefke
Kilo Expert

I'm not sure what to search on to find this, so I'm asking here.

Here's the scenario:

- I have a form with some mandatory fields

- Another form via server script creates a new record for the above stated form with some values populated, but there are still mandatory fields that are not populated, and then navigates to that form

- ServiceNow shows the fields as mandatory, however the user can leave the record without changing anything and the system won't prompt the user indicating the record is incomplete.

I realize what's happening is ServiceNow believes the record is unchanged, so the edits aren't kicking in that tell the user something changed and you need to save it, but you can't save it because there are mandatory fields that are not filled in.

I thought I'd be able to use a client script on the form load to populate a field, hoping it'd appear as if the user entered something, then starting the "website wants you to stay here because it's unsaved" process.   However it doesn't seem to work that way.   The value being set via the client script gets saved, and the mandatory fields stay empty with no prompt to the user indicating they are required.

Any thoughts on how to trigger the "website wants you to stay" logic?

Thanks.

1 ACCEPTED SOLUTION

SandySeegers
Giga Expert

You could set the Dirty Form flag.   Try this in an onload Client Script:



function onLoad() {


    // Reset dirty form flag.


  g_form.modified = true;


}


View solution in original post

4 REPLIES 4

Anurag Tripathi
Mega Patron
Mega Patron

Hi Charles,



Can you   check that any of your client scripts have some thing like this



g_form.checkMandatory=false;


-Anurag

Hello, if I key in one of the fields manually, the "website wants to stay" prompt comes up.  


SandySeegers
Giga Expert

You could set the Dirty Form flag.   Try this in an onload Client Script:



function onLoad() {


    // Reset dirty form flag.


  g_form.modified = true;


}


That did it, thank you!