UI action form button to appear when all mandatory fields are filled
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2018 07:23 AM
Hi Everyone, I've never created an UI Action before and am a bit confused on how to go about scripting it. I want a new Form Button to appear when all the mandatory fields of the form have been completed. Our form has a rather large number of mandatory fields (20+); is there a way to efficiently code this in one or two lines of code instead of listing out every mandatory field to check if it isn't blank?
For example, I know we can write a condition that looks something like this:
current.my_variable1 != ' ' || current.my_variable2 != ' ' || current.my_variable3 != ' ' || ... current.my_variable20 != ' ';
However, we're hoping to condense this down to just 1-2 lines of script.
Any help is appreciated. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2018 07:53 AM
What is the actual requirement that you want to fulfil from the UI action?
There is no need to hide the UI action button just to ensure that user is filling all mandatory fields or not.
Servicenow platform, checks data in all the mandatory fields on the form before user clicks on any button. It will be automatically taken care if you are settint the field mandatory through a client script or UI policy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2018 08:18 AM
ahh good point. Our team wants the button to be disabled or hidden until all mandatory fields are completed, is this possible to do?
As for what the button will actually do...we're hoping to link the button click to trigger a Lifecycle Event Activity, do you know if this is possible as well?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2024 06:26 AM
Facing same issue, any solution?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I am also looking for a solution here.