UI Macro checkbox with text
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 07:22 AM
Hi All.
Im a newbie to servicenow and using ui macros.
I want to have a ui macro with a checkbox and text to it like "I acknowledge the above statement". This will be on a request form and the check box needs to be mandatory.
So far im not able to get the check box and text on the same line and also how would I invoke the check box to be mandatory?
Any suggestions would be much appreciated.
Thanks,
Lucy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 07:33 AM
Lucy,
Can I ask why not create a new field on the Request form of type checkbox instead of creating one through a ui macro? Using ServiceNow native field/data type includes upgrade support and out of the box functionality like being able to use a serviceNow field type in ui actions and ui policies.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 07:42 AM
Thanks for the your reply and suggestion, the reason i thought I would use a UI macro because the text will also contain a hype link to a policy page

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 07:47 AM
Consider using Configure Label on the field (Configuration item shown here)
In the form, set the URL...
Your label then becomes a hyperlink with a ? icon as an extra indicator.
Setting the help field may also work, but isn't quite as elegant. Your choice. Reference here: Field Label Help - ServiceNow Wiki

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2017 07:33 AM
Hi Lucy,
Why do you need a UI macro? Why not just use a standard true/false field? UI macros require custom Jelly coding which is going to be difficult to create and maintain.
The short answer to the mandatory thing is, you cannot make a checkbox mandatory because mandatory checks to see if the field has a value. Checkboxes always have a value (true and false - and false/off/unchecked IS a value.) You would need to use a client script to check if the box is checked and throw a warning if it is not. This is most commonly used in an onSubmit client script to check the status of that field and abort if it is not checked.
Docs: Client Scripts
Docs: GlideForm
Client Script Best Practices - ServiceNow Wiki