Displaying UI Action only on related list

Kamal17
Kilo Sage

Hi,

I'm trying to create a client side UI action (List banner button) on a related list. The button is visible on the related list, but the issue is that the button appears in the default list view of the table also.

I tried to restrict the UI Action visibility by using the condition "g_form.getTitle() == relatedListName" in the condition field. However, the UI Action is displayed even when the condition evaluates to false. Though i have made the UI Action as client side, I see "g_form.getTitle()" is not working in the condition field.

It would be much helpful if someone can suggest me a way to restrict the UI Action to be visible only on related list.

Thanks,

Udhay

9 REPLIES 9

Kamal17
Kilo Sage

Hi,



I tried using RP.isRelatedList() function in the condition field and it solved my issue. Now my UI action button is visible only on related list.


Thank you Tanaji and Pradeep



Regards,


Udhay


For future reference and clarification, for a UI action that was only intended for, in my case, the versions of scripts when already looking at a versionable record, this did not work:

RP.isOneToMany() || RP.isManyToMany()

This did:

RP.isRelatedList()

Ashish Kumar Ag
Kilo Guru

Tanaji's solution will work perfect. To be more specific you can use



For Many-to-Many related list use   RP.isManyToMany()   in condition.


For One-to-Many use RP.isOneToMany() in condition.


Fernnn
Tera Contributor

I'm digging up bones due to a lack of satisfactory answers.

 

What doesn't work:

g_list, GlideList2: Conditions are server-side and cannot access g_list.

RP.anything: I had some trouble reverse-engineering this, but it seems like RP is usually undefined or null on a regular form.

 

 

"parent" object appears to be availabel in the condition field as a GlideRecord object of the record on the form. It will be undefined in a list view. You can use typeof(parent) === "object", or access the properties of "parent" to get more specific. parent.getRecordClassName() === "table_name" should show it only as a related list to a specific table.
"tables" also appears to be an array that, if on a related list, contains the parent table.

Fernnn
Tera Contributor

I should add that I tested more and found that RP does have callable functions, but none of them are useful for this purpose. RP.isRelatedList() didn't seem to do anything (and is undocumented) and is*ToMany doesn't have useful logic for this use-case.