Issue setting field to readonly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 09:16 PM
I'm trying to toggle the read-only property of the Next Step field (u_next_step) on the Service Record screen. I have tried two approaches (UI Policy and Client Script) and neither approach works. I know the code is being executed as I have added log statements to the console. I also in the same code set sys_created_on to read-only (just to see that it works) and that field is being set to read-only while Next Step is not. Both fields are initially editable in the form design. When I create a new SR, the form loads and the Created field is grayed out but the Next Step field is not.
Here is the client script code:
And here are the console statements
I'm sure this should be really simple, but I can't figure it out. Any help would be greatly appreciated. Thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 11:25 PM
I have searched the UI Policies and Scripts can't find anywhere it is being set to mandatory or that the readonly status is being changed. Configure Dictionary shows Read only and Mandatory are false:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 12:49 AM
I noticed that the field name is not the same in both if and else code blocks.
In the IF code block, the field name is u_next_step.
But in the ELSE block, the incident table name is prepended.
Which of these 2 are correct?
Aside from that, your code should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2024 09:36 PM
That was just something I was trying. They should both just be u_next_step, but it still doesn't work. Thx.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2024 11:11 PM
I think I might be misunderstanding something.
Can you tell me the technical name of the target table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2024 11:41 PM
It's the Service Request [incident] table.