Show UI Action Client in Service Portal Form Widget

Gab
Tera Expert

Hello, I would like to ask if there's a way to make UI action client callable appear in Service Portal Form Widget? The reason why I'm using a client callable UI action is to have a confirmation first before firing a server-side script. 

 

My code is similar to this:

//Client-side 'onclick' function
function runClientCode(){
if( == false){
return false; //Abort submission
}
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), ''); //MUST call the 'Action name' set in this UI Action
}//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if(typeof window == 'undefined')
runBusRuleCode();

//Server-side function
function runBusRuleCode(){
current. = ;
current.update();
gs.addInfoMessage('You did it!');
action.setRedirectURL(current);
}

3 REPLIES 3

eumak
Tera Guru

Hello Gab,
From a snow point of view, UI Actions marked Client is not compatible with Service Portal and will be ignored by the Form widget. For the workaround, you can create a custom action button via customizing the form widget for the particular use case.

A similar kind of use case has been explained in the below article - 

Client and Server Side Buttons


Mark it as helpful or correct, If Applicable

Cheers..!
Happy Learning:)
Tushar

Mark it as helpful or correct, If Applicable


Cheers..!

Happy Learning:)

Tushar

Hello Tushar,

Could you give me a simple example on how to do this with custom button widget?

I'm totally new on ServiceNow 🙂

Thanks!

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

client side UI actions are not supported on form widget.

You can use custom form button

check this out

Adding a custom button on a form widget

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader