- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2020 06:43 AM
g_form.setReadOnly() method not working when I run it through Client Script, but it works when I run the same on the JavaScript Executor(Ctrl + Alt + Shift + J), is there a way to debug and know what is stopping my Client Script code to not work on setting the field read only.
The Client Script is:
Solved! Go to Solution.
- Labels:
-
Script Debugger
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2020 07:59 AM
Are there any UI policies that are conflicting with your client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2020 07:18 AM
Fair point, I tend to use it in small scripts with arrays as the efficiency loss is minor and its cleaner to write.
Taking a second look at your code, it's possible that your array is holding field names and not field labels. When referencing a field in scripts you must use their labels.
*Edit
There is also the possibility that the user you are impersonating to test this script is not in the correct groups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2020 07:22 AM
The array is holding field names and the same code works when I use setMandatory method, but something is stopping the setReadOnly and I need a way to know what it is that is preventing the setReadOnly from working, what's strange is that the setReadOnly works when I run it on the pop up JavaScript Executor on the form. I have removed the user condition and it still has the same issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2020 07:30 AM
Are you working in a scoped application? some other community posts asking about g_form.setReadOnly() have identified that g_form only works in the global scope, and not in custom scopes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2020 07:36 AM
Nope, it is written on the Global Incident table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-17-2020 07:59 AM
Are there any UI policies that are conflicting with your client script?