How to disable UI Action in Related List

loteodor
Kilo Contributor


Hi,

I would like to disable the UI Action 'New' on a Related List when a particular field of the main table has a specific value.

Have a look at the screenshot below here (in red the Ui Action).

I have a table 'Budget' with a related List of 'Budget Item' (or cost items) and I would like to disable the UI Action 'New' when the field Budget Sottomesso is equal to 'Si',   namely the budget has been submitted.

Thank you,

LorenzoMod Budget.png

19 REPLIES 19

ayush_saxena
Tera Expert

I am facing the same issue while trying to hide context menu for non admins


I figured the below code some how work but gives stack overflow error


function onLoad() {


    //Disable the context menu for non-admins


    if(!g_user.hasRole('admin')){


          //Disable all form section header context menus


          $$('form')[0].select('tr.header').each(function(elmt) {


                Event.observe(elmt, 'contextmenu', clearMenus());


          });


    }


}


How should i move forward??




Thanks in advance for your help


Hi Ayush,



Why do you have to write a client script ?


Instead go to that particular UI Action and in the condition field give gs.getUser().hasRole('admin') , so that only for users having admin role the context menu will be visible.


Hi Vibha,



I managed to hide save option from context menu but unfortunately ain't managed to find any UI context or context menu for assign tag,reload,templates etc. Hence i opted this as a option


ohhgr
Kilo Sage
Kilo Sage

Hi Lorenzo,



Try creating a new UI Action as "New" specific to your table but with same name, same sysverb_name as the global one.



This should only show the newly created "New" UI Action on your table, but will not affect the Global UI Action "New".



Thanks,


Mandar


ayush_saxena
Tera Expert


Any suggestions on below issue:-


function onLoad() {


    //Disable the context menu for non-admins


    if(!g_user.hasRole('admin')){


          //Disable all form section header context menus


          $$('form')[0].select('tr.header').each(function(elmt) {


                Event.observe(elmt, 'contextmenu', clearMenus());


          });


    }


}


"I am facing the same issue while trying to hide context menu for non admins


I figured the below code some how work but gives stack overflow error"