Hide "New" button from List based on Module name

varadharaj_a
Kilo Contributor

Hi,

I would like to hide "New" button from "All" list based on the Module Name.

For exaample, if the module name is "My Incidents",   it will show all my incidents with "New" button as list view by clicking on it.

But, this New button should not be displayed if it is under "My Incidents" list.

Could anyone help in this?

thanks

VG

1 ACCEPTED SOLUTION

Sorry, one correction in my reply



if RP.getParameterValue('sysparm_userpref_module') =='sys_id'


{


    return false


}


else


{


    if (Existing condition value of New button)


          return true


    else


          return false


}



regards


View solution in original post

8 REPLIES 8

Hi Varadharaj,



you can try in below way to hide New button on single module, else as Adam told please try with RP.getParameterValue('sysparm_userpref_module') == 'SYS ID for modules'.



Please find the New button for particular module (ex. Normal list of incident table) and then make that is Active = False


find_real_file.png


For new module you can create a custom New Button and override on Global one with Roles.


Hi VG,



Get the condition field of New button from UI Action and get the current page parameter value as "RP.getParameterValue('sysparm_userpref_module') =='sys_id' "


create a new Script include to return "true / false" based on the above Condition field value and current page parameter value as below



if RP.getParameterValue('sysparm_userpref_module') =='sys_id'


{


    return false


}


else


{


    if RP.getParameterValue('sysparm_userpref_module')


          return true


    else


          return false


}



and replace the condition field of New button of UI Action with this Script Include.



hope this helps...



regards


Sorry, one correction in my reply



if RP.getParameterValue('sysparm_userpref_module') =='sys_id'


{


    return false


}


else


{


    if (Existing condition value of New button)


          return true


    else


          return false


}



regards


akaupisch
Kilo Guru

So there are a couple of things...



First, the documentation says you should be able to do this via a script on the list control, but it doesn't seem to be working:


Advanced list control with scripts whenever I try something as simple as:


var answer;


answer = true;


answer;


it still shows. So not sure if this is a bug or what.



However, you can create a UI Action for Incident which will override the global one, so it'll only do this on incidents...Then, under the condition statement, put the following:


RP.getParameterValue('sysparm_userpref_module') == 'ID for module' if it matches, it'll show...