Add annotation or info message to a related list tab

matthew_hughes
Kilo Sage

I'm wanting some advice of adding an annotation or info message to a certain tab within a related list.

Related tabs.png

In the above example, I'm wanting to add an info message within the 'Related Risks' tab because if those two values don't appear for the current user, then they haven't got the correct access. I was just wondering what I need to do to get that info message showing if the current user hasn't got the correct access.

2 REPLIES 2

Riya Verma
Kilo Sage
Kilo Sage

HI @matthew_hughes ,

Hope you are doing great.

you can utilize UI Scripts or Client Scripts to add addnotation or info under related list.

1. Create a UI Script or Client Script:

// Define the tab name and related list ID
var tabName = 'tab_name';
var relatedListId = 'related_list_id';

// Retrieve the tab element
var tabElement = document.getElementById(tabName);

// Check if the tab element exists
if (tabElement) {
  // Create the info message element
  var infoMessage = document.createElement('div');
  infoMessage.className = 'info-message';
  infoMessage.innerText = 'Your annotation or info message goes here';

  // Append the info message element to the tab element
  tabElement.appendChild(infoMessage);

  // Modify the related list title to make space for the info message
  var relatedList = document.getElementById(relatedListId);
  if (relatedList) {
    relatedList.style.marginTop = '20px'; // Adjust the margin value as needed
  }
}
Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Hi @Riya Verma Would that be an OnLoad client script