Make Field Read Only according to the condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 06:48 AM
Hi Community, Good Day!!!!
As we know that in incident table when we add value on Caller field then for some users, 'location' field's value auto-populates. So, in my requirement, if location field gets auto-populates, make it read-only, like in below:
and when 'location' does not gets auto-populates and user sets it manually, then make it editable even it is set.
Thanks in Advance!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 11:31 PM
@Kumar887 Create a client script on Incident table as below,
Table : Incident [incident]
Type : onChange
Field name : Caller
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading) {
return;
}
var caller = g_form.getReference('caller_id', setLocation);
}
function setLocation(caller) {
if (caller)
g_form.setValue('location', caller.location);
if(caller.location != ''){
g_form.setReadOnly('caller_id.location', true);
}
else{
g_form.setReadOnly('caller_id.location', false);
}
}
Results :
If location is not empty, make the field as read-only.
If the location is empty, make the field as editable.
Please mark this as helpful and accept it as a solution if this resolves your query.
Thanks,
Sujatha V.M.
Sujatha V.M.