- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 03:58 AM
Hi Folks,
I have a few Name-Value field types on a form - and I'm using an OnLoad Client Script to pull all editable fields - but Name-Value fields do not show-up in the array.
The code that I'm using in the OnLoad Client-Script is:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 05:46 AM
Thanks for the update - but it didn't work. Upon further research - I found this KB from ServiceNow
KB0827178 - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0827178
Look's like there's no solution for it at the moment:
"After carefully considering the severity and frequency of this problem and the risk of attempting a fix, it has been decided to not address this issue in any current or future releases. We do not make these decisions lightly, and we apologize for any inconvenience."
However, one strange thing is - the same code g_form.setReadOnly('u_namevaluePairFieldName',true) works fine in an UI Action script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 05:06 AM
Hello @Vin Fredrick ,
Below code is updated version of your script:
var fields = g_form.getEditableFields();
// List of Name-Value pair fields (replace 'name_value_field1', 'name_value_field2', etc. with actual field names)
var nameValueFields = ['name_value_field1', 'name_value_field2'];
// Combine the arrays
fields = fields.concat(nameValueFields);
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
Thank you!!
Dnyaneshwaree Satpute
Tera Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 05:46 AM
Thanks for the update - but it didn't work. Upon further research - I found this KB from ServiceNow
KB0827178 - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0827178
Look's like there's no solution for it at the moment:
"After carefully considering the severity and frequency of this problem and the risk of attempting a fix, it has been decided to not address this issue in any current or future releases. We do not make these decisions lightly, and we apologize for any inconvenience."
However, one strange thing is - the same code g_form.setReadOnly('u_namevaluePairFieldName',true) works fine in an UI Action script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 05:29 AM
Hi @Vin Fredrick,
Name of the fields (backend name of the value) will get by using the getEditableFields() method. Value are stored in database. so to pull the value need to right Server side script to pull the value of the field.
If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.