How to stop UI Page Redirection after Clicking 'OK'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2020 07:09 AM
Hi All,
I have a UI page for transferring a HRCase to IT Group and once I select the Assignment group and Click OK .
The issue I have is after clicking on OK , the page is getting redirected and not staying on the same form . Please let me know what changes need to be done for achieving this . Below is the UI Page Client Script part .
function yesnoCheck(val)
{
try
{
gel('selected_decision').value = val;
if(val == '1')
{
gel('worknotesection').style.display = 'block';
gel('commentssection').style.display = 'block';
}
else
{
gel('worknotesection').style.display = 'none';
gel('commentssection').style.display = 'none';
}
}
catch(e)
{
alert(e);
}
}
function valdiateGrpValue()
{
var finalresult;
var groupErrorBlock = $j('#groupError');
var groupValue = gel("assignment_group").value;
if(groupValue == '')
{
groupErrorBlock.html(getMessage('Please select a group'));
finalresult = false;
}
else
{
groupErrorBlock.html('');
finalresult = true;
}
return finalresult;
}
function valdiateDecisionValue()
{
try
{
var finalresult = false;
var decErrorBlock = $j('#decError');
var decisions = document.getElementsByName("decision");
var tlscore = '';
for (var i = 0, len=decisions.length; i< len; i++)
{
if (decisions[i].checked )
{
tlscore = decisions[i].value; // if so, hold its value in tlscore
finalresult = true;
break; // and break out of for loop
}
}
if(finalresult)
{
decErrorBlock.html('');
if(tlscore == '1')
{
var notesErrorBlock = $j('#noteError');
if(gel('worknotes').value == '' || gel('worknotes').value == ' ' || gel('worknotes').value == 'undefined')
{
notesErrorBlock.html(getMessage('Please fill Work Notes'));
finalresult=false;
}
else
{
notesErrorBlock.html('');
}
}
}
else
{
decErrorBlock.html(getMessage('Please select decision'));
}
return finalresult;
}
catch(e)
{
jslog(e);
}
}
function submitCancel()
{
GlideDialogWindow.get().destroy();
return false;
}
function submitOk() {
var result = $("assignment_group").value != undefined;
if(!valdiateGrpValue())
{
result=false;
}
if(!valdiateDecisionValue())
{
result=false;
}
if (result)
{
$('cancel_button').addClassName('disabled');
$('ok_button').addClassName('disabled');
}
return result;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2020 07:41 AM
Hi Ram,
Did you try with some other user? Also try to open the same in incognito window
If you comment it then it should not show
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2020 10:24 AM
Hi ,
I have cleared the cache but still that button show on UI page though that line is commented
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2020 08:19 AM
Did you add the </script> line below </footer>? If I paste your HTML - with or without the section commented out, I this error when trying to save
Often for HTML changes to be seen, you need to clear cache. To do this, type cache.do in the left nav, or add it to the end of your URL after service-now.com/ then log in again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2020 10:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2020 12:13 PM
It seems like the UI Page record that you are modifying is not the same one that is display the dialog window. The earlier missing </script> tag would have prevented it from displaying, and now this mysterious displaying of the radio button and label even when those lines are commented out. If you click the Try it button on the UI Page record you'll see that Keep HR Case Open is hidden. You need to go back to the UI Action, UI Macro, client script, or whatever it is that is causing this window to open and check the name of the UI Page that is called, then make sure there is not more than one in different applications/scopes.