UI Action Condition on a specific related list

Taylor W
Mega Expert

Hello! We are trying to hide/show a custom UI Action based on a related list ID. We only want to show that UI Action on a very specific related list.

For example: IF Related List ID is REL:7f22341ca1ba20107f612a6c7e377117

Is there anyway to do this? Thanks!

1 ACCEPTED SOLUTION

Looks like this does not work in scoped apps. To workaround this we made our own function. Below is our script include. 

function isListLabel(RP, label) {
    var sysId = RP.getListControl().getControlID();
    var gr = new GlideRecord('sys_ui_list_control');
    gr.get(sysId);
    var grLabel = gr.getValue('label');
   
    if (grLabel == label) {
        return true;
    }
    return false;
}

 

View solution in original post

6 REPLIES 6

Kieran Anson
Kilo Patron

You can base it on the name by using:

RP.isRelatedList() && RP.getListControl().label.equals('name of list')

Thanks! This actually does not work in a scoped app. We ended up building our own function to something similar but it returns ID for the list.

It appears to be working in scoped apps now.

Looks like this does not work in scoped apps. To workaround this we made our own function. Below is our script include. 

function isListLabel(RP, label) {
    var sysId = RP.getListControl().getControlID();
    var gr = new GlideRecord('sys_ui_list_control');
    gr.get(sysId);
    var grLabel = gr.getValue('label');
   
    if (grLabel == label) {
        return true;
    }
    return false;
}