UI action not working

SanthoshKumar R
Tera Contributor

Please help me to find the error in the code

 

function onClick()
{
    g_form.setDisplay('suspend_reason',true);
    g_form.setMandatory('suspend_reason',true);
    gsftSubmit(null, g_form.getFormElement(), "suspend");
}

if (typeof window == 'undefined')
   setRedirect();

function setRedirect() {
    action.setRedirectURL(current);
}
3 REPLIES 3

Maik Skoddow
Tera Patron
Tera Patron

Hi

sorry, if you want an answer, you have to provide more details. For example, which error exactly occurred and where. And what is the purpose of your Business Rule?

Maik

Ankur Bawiskar
Tera Patron
Tera Patron

@SanthoshKumar R 

Please share the business requirement here.

Why not use UI policy or client script to make the field mandatory? Why to use UI action?

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

Chaitanya naram
Kilo Sage

@SanthoshKumar R  Please do below checks.

 

1) What is the client function name you defined in the onClick Variable and are you using the same function in the script.

Sample Function name in onClick Variable: actionCheck()

 

2) Please check whether you are using the correct name in the gsftSubmit function. You need to use the action name of the UI action in 3 parameter.

 

If there is no mistakes in above.

 

And if your requirement is to make a field mandatory on click on an UI action, you are doing the same. If you say that the field is became non-mandatory after UI action ran, then may be there is an UI policy on that field to make field non-mandatory or hidden on load.

 

Please mark my answer correct if it helps in resolving your issue.

Thanks & Regards | Chiranjeevi Chaitanya Naram
Kindly mark the answer Correct and Helpful if it helps to resolve your issue.