Advanced list control with scripts

You can write scripts to specify which list elements, such as links, filters, and buttons, are present.

These scripts can react to the record that is being displayed. For related list controls, the parent record is identified by the global variable parent. For primary lists, there is no parent record.

Configure the List Control form and add the script field that you need:
  • Omit Columns Condition: Omit column headings if there are no conditions.
  • Omit Edit Condition: Omit the Edit button.
  • Omit Empty Condition: Omit the list header if there are no conditions.
  • Omit Filter Condition: Omit the list filter.
  • Omit Links Condition: Omit related links.
  • Omit New Condition: Omit the New button.
In these script fields, if the script evaluates to true, the item is omitted. The following script is an example that you can use on the Affected CIs related list to show only the Edit button if the parent task is active. This script is placed in the Omit Edit Condition script field.
var answer;
 if (parent.active == true ) {
 //Do not remove the 'Edit' button
  answer = false; 
} 
else {
 //Remove the 'Edit' button
  answer = true;
}
answer;

Configure a list UI action

You can create a UI action that opens the slushbucket interface to customize lists in the list view.

Before you begin

Role required: ui_action_admin

Procedure

  1. Navigate to System Definition > UI Actions.
  2. Click New.
  3. In the Table field, select the List [sys_ui_list] table.
  4. Select the List context menu check box.
  5. Ensure the Active check box is selected.
  6. Paste the following script in the Script field:
    var url  = "slushbucket.do?sysparm_form=list&sysparm_list=" + current. name + "&sysparm_view=" + current. view. name ;
    url  += "&sysparm_collection=" + current. parent + "&sysparm_collection_relationship=" + current. relationship ; 
    url  += "&sysparm_referring_url=sys_ui_view.do?sys_id=" + current. view. toString ( ) ;
    action. setRedirectURL (url ) ;
  7. Click Submit.