The CreatorCon Call for Content is officially open! Get started here.

How to refresh the UI page after click on approve button

chaitanyakumar
Tera Expert

Hi,

I have UI page on approval record when the state change to approved and click on update we are displaying this UI page and if user click on accept it is changing to state to approved but it is asking for reload the page to save changes. Here are my client script and UI page

Client Script:

function onSubmit() {

   

  //confirm Pop Up Window

  if( g_form.getValue('state')=='approved'){

  var ga = new GlideAjax('approveChange');

  ga.addParam('sysparm_name','checkCABApproval');

        ga.addParam('sysparm_approverID',g_form.getUniqueValue());

  ga.getXMLWait();

        var answer = ga.getAnswer().toString();

  //alert(answer);

  if(answer == false || answer == 'false') {

  g_form.setValue('state', 'approved');

  //g_form.submit();

  }

  if(answer == true || answer == 'true') {

  var gd = new GlideDialogWindow('confirmation_page');

  gd.setTitle('Accept terms and conditions');

  gd.setPreference('approval_sys_id', g_form.getUniqueValue());

  gd.render();

  return false;

  }

  }

find_real_file.png

Can anyone help me to refresh the UI page after i click on accept button?

Thanks,

Chaitanya

1 ACCEPTED SOLUTION

Jorge Andre Per
Kilo Expert

Hello Chaitanya,



I believe the function you are looking for is: gsftSubmit(document.getElementById('sysverb_update_and_stay'));



You can add the function before opening the Dialog or in the UI Page in the function that gets called when the user presses "OK". Check the following link for an example: GlideDialogWindow: Advanced Popups Using UI Pages - ServiceNow Guru



Best of luck,


Jorge


View solution in original post

2 REPLIES 2

Jorge Andre Per
Kilo Expert

Hello Chaitanya,



I believe the function you are looking for is: gsftSubmit(document.getElementById('sysverb_update_and_stay'));



You can add the function before opening the Dialog or in the UI Page in the function that gets called when the user presses "OK". Check the following link for an example: GlideDialogWindow: Advanced Popups Using UI Pages - ServiceNow Guru



Best of luck,


Jorge


I am not doing this from UI action. I am changing the state to approved and clicked on update then i got this UI page and reload message. The above functions is works for UI action



Thanks,


Chaitanya