g_form.setDisabled('opened_for',false) not working in OnLoad client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 05:03 AM
Hi Everyone,
I have a requirement that I need to show 'loading' message on "Opened For" field and make the field disabled/readonly until I get the response from script include.
I have an onLoad client script to do this, PFB.I 'm able show the 'Loading' message, but unable make the field readonly/disabled.
I Also tried with g_form.setReadOnly('opened_for',true), but no luck, Seems that setDisabled & setReadOnly is not functioning on OnLoad client script.
function onLoad() {
g_form.setValue('opened_for', '-', getMessage('Loading...'));
g_form.setDisabled('opened_for',true);
//Here I'm calling script include
}
Result is:
What I need is like below
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 05:15 AM
Just to confirm is Opened For field defaulted to be mandatory? If so, can you try making it non-mandatory & check.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 08:31 PM
Opened for field is non-manadatory field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 08:38 PM
Hi, As you will populate the opened by field through script include, it is not required again to update that field with "loading"..
It's causes disruption like at a time on a single field you are applying 2 scripts will is not at all a best practice..
I suggest you two ways...
1. Go to dictionary entry and make that field as read-only
2. Create a client script with isNewRecord and with in this method make that field as read-only
@Guidapti Hemalatha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 08:53 PM
if(g_form.isNewRecord()){
g_form.setReadOnly('opened_for',true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2022 08:55 PM
Can you confirm if both your Script Include and Client script are in same Application scope?
Regards.,
Shloke
Regards,
Shloke