Skip to main content
Skip table of contents

Set read only state on a secondary list.

NOTE: This functionality is only available in GlobalSearch Go

Component states may change if GlobalSearch Go needs to redraw dynamic controls. If you need to lock a dynamic list, the script below can poll for the state and set it correctly.

JS
const interval = setInterval(() => {
  if(!$$inject.fieldProperties['Secondary'].readOnly){
    $$inject.fieldProperties['Secondary'].readOnly = true;
    console.log("Secondary field set to read-only.");
  }
  console.log("Polling Secondary field read-only status...");
}, 500);

setTimeout(() => {
  clearInterval(interval);
  console.log("Secondary field poll stopped.");
}, 5000);

return 'Loaded';

🔍 Line-by-Line Breakdown

1. Start a Repeating Check

javascript

JS
const interval = setInterval(() => {
  if(!$$inject.fieldProperties['Secondary'].readOnly){
    $$inject.fieldProperties['Secondary'].readOnly = true;
    console.log("Secondary field set to read-only.");
  }
  console.log("Polling Secondary field read-only status...");
}, 500);

This sets up a loop that runs every 500 milliseconds (half a second). Each time it runs:

  • It checks if the Secondary field is still editable.

  • If it is, it locks it and prints a message.

  • It also prints a message saying it's checking.

Think of it like a security guard walking by every half second saying, “Is this door locked? No? Let me lock it.”

2. Stop the Loop After 5 Seconds

javascript

JS
setTimeout(() => {
  clearInterval(interval);
  console.log("Secondary field poll stopped.");
}, 5000);

This sets a timer to stop the security guard after 5 seconds. It’s like saying: “After 10 checks, you can go home.”

3. Return a Status Message

javascript

JS
return 'Loaded';

This just returns a message saying the script has finished loading to the Live Field.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.