How can i hide list context menu based on condition not satisfied

indira_parimi
Tera Contributor

Hi,

I have created a custom UI Action -List context menu for a custom table. In this UI Action, I've provided a condition to  the UI Action.

But when condition is not satisfied the List context menu, I can view list context menu action and when clicked I get the message "Security does not allow the execution of that action against the specified record".

 Instead of displaying a message, I would like to hide the UI Action when the condition is not satisfied? How can I achieve it.

Thank you.

 

5 REPLIES 5

Santosh_Ksagar
Mega Sage
Mega Sage

Hi Indira,

There is a role condition in UI action.  Try adding role and then see if it satisfies your requirement.

 

Please make Correct or Helpful.

 

Warm Regards

Santosh Kshirsagar

www.dxsherpa.com

joeyfrease
Tera Expert

Hi, have you had any luck with this question?  I've been able to hide a button based on a selection on a form (not saving it) using an onChange example I found and have pasted below.  But as you can easily see it's only good for 'BUTTON' options and not list context menu.  Works perfectly, if there were only a 'LISTCONTEXTMENU' option instead of 'BUTTON'.  

var items = $$('BUTTON').each(function(item){

g_form.addErrorMessage('items --- ' + item.innerHTML);


if(item.innerHTML.indexOf('Delete') > -1){

item.hide();


}


});


}


else {


var items2 = $$('BUTTON').each(function(item){


if(item.innerHTML.indexOf('Delete') > -1){


item.hide();


}


});


}

 

Thank you in advance.

Felipe Reis2
Giga Contributor

Hi,

If you are trying to use 'current', it is not possible. 

'The current object is not available for conditions on a list context menu (the List context menu check box is selected). Any use of current on these actions is ignored.' See more here...

But, you can create a Script Include and a function to validate it.
Something like this:


Function on Script Include

UI Action condition: new YourScriptInclude().canPropose(task_ci);

Hope this helps.

Regards 

Felipe Reis

The image links are broken. Can you please help on how can we achieve it ?

 

Thank you