- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2017 01:14 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2017 01:49 PM
You can achieve by using client functionality in UI actions
here is the sample script that check if there are any test cases under a test plan (current)
You can you the same logic for checking if change tasks are present
Go through this article
Client & Server Code in One UI Action - ServiceNow Guru
which explains you how the client side functionality works
function test_case()
{
var test = new GlideRecord('tm_test_case_instance');
test.addQuery('tm_test_plan', g_form.getUniqueValue());
test.addQuery('active',true);
test.query();if(test.next())
{
gsftSubmit(null, g_form.getFormElement(), 'plan_approval');
}
else
{
alert('Atlease one test case should be added to the list');
return false;
}
}if(typeof window =='undefined'){
updateChange();
}function updateChange(){
current.state = '3';
current.update();action.setRedirectURL(current);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2017 01:20 PM
Hi,
Sorry, UI actions do a page reload when you do current.update() (save your changes).
What is the issue you are trying to solve?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2017 01:41 PM
Hi Chuck,
While submiting a change, I need to display an error message(should not do the current.update()) if there is no tasks under particular change request.
Now I'm able to display the error message , but it's disappearing with in 1 second and page is reloading.
I want to show that error message until user closes it.
Thanks
Bala

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2017 01:49 PM
You can achieve by using client functionality in UI actions
here is the sample script that check if there are any test cases under a test plan (current)
You can you the same logic for checking if change tasks are present
Go through this article
Client & Server Code in One UI Action - ServiceNow Guru
which explains you how the client side functionality works
function test_case()
{
var test = new GlideRecord('tm_test_case_instance');
test.addQuery('tm_test_plan', g_form.getUniqueValue());
test.addQuery('active',true);
test.query();if(test.next())
{
gsftSubmit(null, g_form.getFormElement(), 'plan_approval');
}
else
{
alert('Atlease one test case should be added to the list');
return false;
}
}if(typeof window =='undefined'){
updateChange();
}function updateChange(){
current.state = '3';
current.update();action.setRedirectURL(current);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2017 01:51 PM
Hi Balarammfs,
Can you share your code if possible ?