/ Create a new inline HTML field called "defaultButton" on the scriptContext.form
let defaultButton = scriptContext.form.addField({
id: "custpage_hide_buttons",
label: "default button",
type: serverWidget.FieldType.INLINEHTML,
});
// Initialize the JavaScript code string
let scr = "";
// Append JavaScript code to the scr variable
scr +=
"setTimeout(function(){" +
// Get a reference to the iframe with the ID "boxnet_widget_frame"
'var iframe = document.getElementById("boxnet_widget_frame");' +
"console.log(iframe);" +
// Get a reference to the element with the ID "default-association" inside the iframe
'var button = iframe.contentWindow.document.getElementById("default-association");' +
// Check if the button exists
"if (button) {" +
// Log the button element to the console
'console.log("Button Element:", button);' +
// Execute the click function on the button
"button.click();" +
"}" +
"}, 8000)";
// Set the generated JavaScript code as the default value of the "defaultButton" field
defaultButton.defaultValue = "<script>" + scr + "</script>";