
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 08:17 AM
I have a Client Script on the sc_task table where I have the following code:
var variable_map_items = $("variable_map").querySelectorAll("item");
for (i = 0; i < variable_map_items.length; i++) {
variable = variable_map_items[i].getAttribute("qname");
g_form.setReadOnly("variables."+ variable, false);
}
I would like to mention that in my ROME instance (and earlier), the above code works great.
However, our DEV instance just upgraded to Sandiego and it is no longer working.
What changed in Sandiego where you can't do this anymore?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 12:20 PM
So, here's the real answer, which isn't mentioned anywhere in the docs! Grrrrr!
San Diego - Take actions to keep "write roles" on Catalog Variables working
Basically, I needed to insert a sys_property called glide.sc.evaluate.variables.write.access and set the value to false
Once I did that, everything worked like a charm.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 09:24 AM
correct, it worked in an onLoad client script.
To replicate/show you on here, here is the code through the javascript executor (Press "Alt+Ctrl+Shift+j" to open the Javascript Executor.)
Before: field is read only
After executing, field is not read only

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 11:10 AM
When I click "Run my code"... absolutely nothing happens. Looks like I need to open a HI ticket.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 08:50 AM
Looking further, g_form.setMandatory() also no longer works in the same context as above in Sandiego

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 11:06 AM
So, this is what we need to do now to make a variable non-readonly and allow users to update them:
var variable_map_items = $("variable_map").querySelectorAll("item");
for (i = 0; i < variable_map_items.length; i++) {
variable = variable_map_items[i].getAttribute("qname");
var e = form.getControl("variables."+ variable);
if (e) {
var el = document.getElementById('element.'+e.id);
if (!el) {
el = document.getElementById('element.'+e.id+'_read_only');
}
if (el) {
fFound = true;
if (thisTable == "sc_task") {
//g_form.setReadOnly("variables."+ variable, false);
var actualFormFieldInHTML = document.getElementById(e.id); // This should be the hidden input field that stores the actual value that gets passed to the server when saved
if (actualFormFieldInHTML){
actualFormFieldInHTML.readOnly = false;
}
var actualFormFieldInHTML_ro = document.getElementById(e.id+'_read_only');
if (actualFormFieldInHTML_ro){
actualFormFieldInHTML_ro.readOnly = false;
}
if (actualFormFieldInHTML && actualFormFieldInHTML_ro){
actualFormFieldInHTML_ro.addEventListener("change", function() {
actualFormFieldInHTML.value = actualFormFieldInHTML_ro.value;
});
}
}
} else {consoleWarn("el NOT FOUND");}
} else {consoleWarn("e NOT FOUND");}
}
The key was setting an event listener:
actualFormFieldInHTML_ro.addEventListener("change", function() {
actualFormFieldInHTML.value = actualFormFieldInHTML_ro.value;
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2022 12:20 PM
So, here's the real answer, which isn't mentioned anywhere in the docs! Grrrrr!
San Diego - Take actions to keep "write roles" on Catalog Variables working
Basically, I needed to insert a sys_property called glide.sc.evaluate.variables.write.access and set the value to false
Once I did that, everything worked like a charm.