Hide UI action

shabbir9
Tera Contributor

Hi Team

i want to hide UI action button on custom table form (U_incident) i am trying add add condition in UI action but the problem is already there are several conditions mentioned in that filed and that condition filed is full i am not able add my table name in that condition is there any other way to hide that button for my table can any one help me in the script or any other way   

1 ACCEPTED SOLUTION

@shabbir9 Here is the script include code.

 

var UIActionConditionCheck = Class.create();
UIActionConditionCheck.prototype = {
    initialize: function() {
    },

    checkConditions: function(current) {
        return current.isValidRecord() &&
               current.canWrite() &&
               gs.getProperty('glide.ui.is_submit') != 'true' &&
               current.sys_class_name != 'change_request' &&
               current.sys_class_name != 'incident';
    },

    type: 'UIActionConditionCheck'
};

 

Here is how you should add condition in your condition field of UI Action.

 

new UIActionConditionCheck().checkConditions(current);

 

Hope this helps.

View solution in original post

4 REPLIES 4

Sandeep Rajput
Tera Patron
Tera Patron

@shabbir9 Except for the role (which you can specify using requires role field)UI Action condition field is the only way by which you can control the visibility of the UI Action. If your UI Action condition field is already full, then you can plan to shift the UI Action conditions to a script include and inside your script include you can add as many conditions as you want and return true/false from your script include function to show/hide the UI Action. 

 

Here is an example of how you can call a script include method from the condition field in the UI Action.

 

Screenshot 2024-09-03 at 10.26.31 PM.png

Hope this answers your question.

Hi @Sandeep Rajput  Thank you for your reply could you please help me in the script include script my UI action condition is----current.isValidRecord() && current.canWrite() && gs.getProperty('glide.ui.is_submit') != 'true' && current.sys_class_name != 'change_request && current.sys_class_name != 'incident'     How to add this condition in script include script could you please share sample script..

@shabbir9 Here is the script include code.

 

var UIActionConditionCheck = Class.create();
UIActionConditionCheck.prototype = {
    initialize: function() {
    },

    checkConditions: function(current) {
        return current.isValidRecord() &&
               current.canWrite() &&
               gs.getProperty('glide.ui.is_submit') != 'true' &&
               current.sys_class_name != 'change_request' &&
               current.sys_class_name != 'incident';
    },

    type: 'UIActionConditionCheck'
};

 

Here is how you should add condition in your condition field of UI Action.

 

new UIActionConditionCheck().checkConditions(current);

 

Hope this helps.

Thank you so much for your help @Sandeep Rajput it helped me a lot