Trigger a UI action on client script

Khalnayak
Tera Guru

Hi all,

I have the following requirement:

1) If a users selects P1 or P2 as the incident priority the user is alerted with a pop-up that asks the user to confirm if they want to propse a MI
2) If the user selects continue the Propose a MI workflow is initiated.
So the confirm should only popup if the priority field CHANGES to 1 or 2, and not if it already is 1 or 2.

I have tried using the following onChange clie

function onSubmit() {
    var priority = g_form.getValue('priority'); 
    if (priority == 1 || priority == 2)
 
   var response = confirm('Priority 1 & 2 tickets follow the major incident process. Please confirm that you would like to propose this ticket as a Major Incident.');

 If cancel is pressed or the dialog is closed the response is empty	
   if (!response){
      return;
   }
    gsftSubmit(null, g_form.getFormElement(), 'sysverb_mim_propose'); //MUST call the 'Action name' set in this UI Action
}

the confirm function works and it pops up but the UI action does not trigger.

Please advise.

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

Solution has been added on thread below. 

https://community.servicenow.com/community?id=community_question&sys_id=4bb2d7e6dbf1e450ab0202d5ca96...

 

Please mark the answer correct and close this thread as well. 

 

 

View solution in original post

10 REPLIES 10

palanikumar
Giga Sage

Hi,

gsftSubmit calls the Server side Script of the UI action. Can you check whether the UI Action has Server side script.

You can refer this link for more details:

https://servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/

Thank you,

Palani

Thank you,
Palani

Thanks,

it doesnt look like it has a server side script, see screenshot:

Would this be the server side script?

 

find_real_file.png

Khalnayak
Tera Guru

@Ankur Bawiskar @Ashutosh Munot @Jaspal Singh