How can I add the red asterisk to the label but not make mandatory?

Jeff316
Kilo Guru

Hi All in the community,

Here is my business requirement.

Let's say on the change form, I have 10 fields and they will all be mandatory when the state=authorize.

It's working fine with no problems. As soon as they try to move to authorize and if any of those 10 fields are null they get hit with the red asterisks, the alert and so on....

What they would like to see is a red asterisk on those 10 fields at the state before it's mandatory so they know ahead of time what to populate even before they try to move to authorize.

They want to already have the mandatory fields filled out before the application has to throw the error and tell them the fields are mandatory.

The red asterisk would be an indicator that the field "WILL" be mandatory if they attempt to move to the next state.

I'm going to research now, but if anyone seeing this already knows the method, I would appreciate a hint.

Thanks everyone.

Jeff

2 REPLIES 2

nitin_kumar
Mega Guru

Hi Jeffrey,



I don't know how to achieve what you are asking for but I can suggest you a workaround. You can try annotating the form or use info messages to display the names of the fields that are going to be mandatory based on the state.



Annotating Forms - ServiceNow Wiki


Scripting Alert, Info, and Error Messages - ServiceNow Wiki



Thanks,


Nitin.



Please set correct, helpful or like based on impact of the response


andrew_e
Giga Contributor

For you future googlers.

What you're looking for is the g_form.addDecoration('field_name', 'icon-name', 'Help Text', 'CSScolor') method. If you want the red asterisk your 'icon-name' parameter will be 'icon-required'. For the use case above you'd set an on change client script to addDecoration each of the required fields.