Related List UI Action button is missing in workspace

Mohammed Ameen
Tera Contributor

Hello Everyone,

 

I have created two custom tables: Talent and Companies. Using these tables, I created an M2M table to establish a many-to-many relationship. 

In the M2M table, I created a List UI Action, which works as expected in the Native UI. However, in Workspace, the UI Action is missing.

 

FYI, I enabled Workspace Form Button, Workspace Form Menu and Format for Configurable Workspace. I also added the same script in the Workspace Client script.

 

Additionally, I checked Declarative UI Actions (both List and Related List) but my Ui Action was not present there.

However, it does appear in the UX Form Action Layout Items.

 

Can anyone help me understand what went wrong and why my UI Action is missing in the workspace M2M related List?

 

Note: The UI Action is visible in under the M2M record in workspace, but not in the related list within Workspace.

6 REPLIES 6

Itallo Brandão
Kilo Guru

Hello Mohammed,

I ran into a similar issue when trying to display a List UI Action in a Workspace for a custom M2M table. Here are a few things I learned and steps you might try:

  1. Difference Between Classic UI Actions and Workspace Actions

    • The standard UI Actions you create (e.g., “List” type actions) appear in the Native UI but do not automatically show up in Workspace.
    • In Workspace (especially Configurable Workspaces), actions often need to be configured as Declarative Actions or included in the UX Action Framework via UI Builder or the Workspace Experience.
  2. Check Your Action Definition

    • You mentioned you enabled “Workspace Form Button,” “Workspace Form Menu,” and “Format for Configurable Workspace” on the UI Action. Those are good starts for form actions.
    • However, for list actions—particularly on a related list—you may need a separate configuration, since the “Form Button” or “Form Menu” settings won’t automatically cover list/related-list scenarios in Workspace.
  3. Declarative Action vs. UX Form Action Layout

    • You mentioned seeing the UI Action in the “UX Form Action Layout Items” (so it’s recognized for form context).
    • For it to appear on the related list in Workspace, you might need a Declarative Action specifically configured for “Related List” usage.
    • In many cases, you’ll go to Declarative Action > Action Assignment (or via UI Builder in your Workspace) to ensure the action is assigned to the correct “List” or “Related List” context.
  4. Check UI Builder or Experience Settings

    • If you are using UI Builder for the Configurable Workspace, confirm that the data resource (representing your M2M table/related list) includes your action in its “Actions” configuration.
    • Sometimes, you have to manually add the custom action (or a “button”) in the relevant panel so it appears in the related list context.
  5. Create a Separate Action for the M2M List

    • In some scenarios, you need a separate UI Action or Declarative Action specifically for the “many-to-many” table if you want a button on that related list.
    • It can have the same script logic, but the “List” or “Related List” context must be set to “Workspace” (in addition to any form usage, if desired).
  6. Verify Roles and Conditions

    • Double-check that the UI Action’s conditions (roles, “visible” scripts, etc.) are being met in Workspace.
    • If your M2M table or list is only visible to certain roles, ensure your user in Workspace has those roles as well.

Key Takeaways

  • Classic UI list actions don’t always migrate seamlessly to Workspace.
  • Using Declarative UI Actions or the UX Action Framework is often required for related-list actions in Configurable Workspaces.
  • If you only see the action under “Form Action Layout,” that suggests it’s recognized for form context, not for list/related-list context.

Hopefully these tips help you pinpoint why your UI Action is missing in the Workspace related list. If you have any follow-up questions or discover a particular fix, let us know so others can benefit.

Best regards,
Itallo Brandão

Hi @Itallo Brandão , 

 

Thanks for your response.

 

I created a sample declarative list UI Action for testing and selected a table as my m2m table, but I still don't see the UI Action in my m2m table workspace list view.

 

Please let me know if I am missing anything.

Hi @Itallo Brandão ,

 

I have created a declarative list action and now I am able to view the UI Action in my m2m table workspace list view.

I tried by adding my code which is working fine in my native view UI Action, but unfortunately it is not working in my declarative list UI Action scripting, could you please let me know what went wrong in my script and how I can fix this.

 

Scenario: If a user selects multiple records in the m2m table list view and click the UI action it should change the field status of the records.

 

For the above scenario I have created script include and client script please let me know what went wrong with my code.

 

Script Include: 

var UpdateSelectedRecordsCleared = Class.create();
UpdateSelectedRecordsCleared.prototype = Object.extendsObject(global.AbstractAjaxProcessor, {

    stateCleared: function(){
        var sysIds = this.getParameter("sysparm_sysIds");
        var newState = this.getParameter("sysparm_newState");

        if(!sysIds){
            return "No Records has been selected. ";
        }

        var am = new GlideRecord("x_gsg_tearsheet_m2m_x_gsg_tearsh_coverage");
        am.addQuery("sys_id", "IN", sysIds);
        am.query();
        while(am.next()){
            am.clearance_status = newState;
            am.update();
        }
        return "Clearence Status has been updated to Cleared. ";
    },

    type: 'UpdateSelectedRecordsCleared'
});
 
Declarative list UI Action server script:
 
function clearedState(){
    var selectedRecords = g_list.getChecked();
    if(!selectedRecords){
        alert("Please select at least one record. ");
        return;
    }

    var am = new GlideAjax("UpdateSelectedRecordsCleared");
    am.addParam("sysparm_name", "stateCleared");
    am.addParam("sysparm_sysIds", selectedRecords);
    am.addParam("sysparm_newState", "2");

    am.getXMLAnswer(function(response){
        alert(response);
        g_list.refresh();
    });
}
 
Thanks much.
 

Hello again,

Great to see you can now view your Declarative List UI Action in Workspace. The issue likely comes from using classic UI references (g_list and alert). Below is a sample script that uses Workspace-friendly methods:

 

function clearedState() {
  // Obtain selected records; in Workspace, g_list is unavailable.
  var selectedRecords = this.action.getSelectedSysIds();
  
  if (!selectedRecords || selectedRecords.length === 0) {
    // Use a Workspace-friendly notification instead of alert().
    nowNotification.show("error", "Please select at least one record.");
    return;
  }

  // Use GlideAjax to call your Script Include on the server.
  var ga = new GlideAjax("UpdateSelectedRecordsCleared");
  ga.addParam("sysparm_name", "stateCleared");
  ga.addParam("sysparm_sysIds", selectedRecords.join(","));
  ga.addParam("sysparm_newState", "2");

  ga.getXMLAnswer(function(response) {
    nowNotification.show("info", response);
    
    // Refresh the Workspace list.
    // Replace this with the correct refresh method if needed:
    // this.dataList.refresh();
  });
}

 



Key Points:

  1. Replace g_list
    Workspace has different client APIs (like this.action.getSelectedSysIds()), not the classic g_list.
  2. Avoid alert()
    Use a Workspace notification component or nowNotification.show().
  3. Refresh the List
    Instead of g_list.refresh(), call the Workspace list or data resource refresh function. The exact method depends on how your page is configured in UI Builder.
  4. Maintain the Script Include
    Your existing UpdateSelectedRecordsCleared script should remain the same, as it handles server-side updates.

With these changes, your UI Action should successfully update the field status of selected M2M records in Workspace. If you run into any other issues (such as needing separate roles or a different data refresh approach), let me know.

Best regards,

Itallo Brandão