Set field read only in Agent Workspace using UI Builder
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2024 04:46 AM
Hi,
I am unable to set a form field read only in Agent workspace.
This can be achieved in platform view usinge g_form in client script or UI policy action.
Same is not reflecting in Agent Workspace view.
Need to achieve this in HR agent workspace for Email Draft experience.
Table: sys_email_draft.
OOB GlideForm datasource is not returning fields for the record.
Hence, I am not able to use below script in UIB client script
api.data.glide_form_1.nowRecordFormBlob.fields;
// nowRecordFormBlob is undefined in console log
As per the docs I am trying to use below script to achieve this.
api.data.gform.setReadOnly({fieldName: 'reply_to', readonly: true});
Reference: UIB - API
Not able to find a good example for this.
Any suggestions will be helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2024 10:52 AM
So i'm not certain exactley in what context this is run, is it a form buttion (next experience UI Action), is it a related list button or something else?
However i did try multiple of the things you mentioned, and odly enough they dont work, a lot of the other events like set value, set mandatory and so on work, but the event for read only does not seem to do much.
However this is a workaround to this. If you setup a form controller data source (its just called "form" inside data sources) then one of the events bound to that data source is the [Declarative actions] Execute Client script, which takes a few input parameters and enables you to write a script to do some work for you.
Assuming you are doing this via a form, then you should still have access to the g_form object inside the script, which can then do the work for you.
In my example i bound the event to a button click, but you can easily change it to be a on page ready event so that the field is read only as soon as the page loads (this even is found when selecting the body node in the tree in UI Builder and then going to events)
Hope this helps, if not please supply more information so we can better help you.