UI action - onLoad issue
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2015 12:17 AM
Hi All,
We are making some fields mandatory on click of one UI action button. It is working fine when the form is fully loaded but if we click this button in onLoad it self then it is not asking for fields mandatory its going to next step.
Can we over come the issue in any way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2015 10:28 PM
Hi,
Yes. you can write a Onload script for this.
This may help you.
https://community.servicenow.com/thread/163011
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2015 10:51 PM
I tried this in onLoad but I am able to click the button and it is not asking for mandatory fields, it is moving to next step
function onLoad()
function hideSaveMoveToNextStepButton(button) {
//Remove the 'Close Task' button
var items = $$('BUTTON').each(function(item){
if(item.innerHTML.indexOf(button) > -1){
item.hide();
}
});
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2015 11:13 PM
Hi,
Use this onload client script. You can see the buttons id using inspect element.
function onLoad() {
$('YOUR BUTTON_ID').hide();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2015 12:29 AM
Tried this but it is not working. Because of this UI policies are not working on the form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2015 12:36 AM
Can you show the code which you used to hide the macro