How to write a client script to hide a UI Action (button) in Jakarta for a custom scoped application

Lon Landry2
Tera Contributor

After 8 hours; I am stumped trying to hide a button on a form.

I am aware of many solutions but none work in Jakarta for a custom scoped application.

It seems as though ServiceNow is moving away from custom scoped applications by limiting functionality and API availability.

Although I hope this is not the case...

I believe that I am limited to using the following APIs

  • GlideAjax
  • g_form
  • GlideDialogWindow

There is a condition, but I want to simply hide a button before moving on to more complicated tasks.

The end goal is hiding a button based on Session language settings.

The condition is based on browser settings (g_lang), but I could not figure out how to write an if / else statement in the UI Action Condition field.

This is an example of the (working) client script I use with g_lang:

function onLoad() {

    //Check session browser language settings

  //Display u_music_language field for English settings

  //Display u_music_idioma field for Spanish settings

if(g_lang == 'en'){

  g_form.setDisplay('u_music_language', true);

  g_form.setDisplay('u_music_idioma', false);

}

else if(g_lang == 'es'){

  g_form.setDisplay('u_music_language', false);

  g_form.setDisplay('u_music_idioma', true);

}

}

Thanks for your help and time,

1 ACCEPTED SOLUTION

You are very welcome. Thanks for participating in the community!


View solution in original post

14 REPLIES 14

URL


https://dev10457.service-now.com/<https://dev10457.service-now.com/?_ga=2.54728299.1975948600.1511724454-798883617.1511724454>



Build


Jakarta



I am not sure where to find more detailed instance release data...


Hello Lon,



I've fixed this issue on your instance. Please check now.



FYI: I've inactivated the UI action button and created the new one + modified the client script.



I hope this helps.


Thanks!



Works perfectly!


You are very welcome. Thanks for participating in the community!


Could any of you please share the solution with me too? It will be very helpful to me.

 

Thanks

Sugandha