How to make name value pair data type field read only?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2018 04:21 AM
Hi,
Please let me know how to make the name value pair field read only. Tried creating UI Policy, Client script and mentioning Read only in dictionary. its not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2018 01:46 PM
Greetings Manimozhi,
I seem to have the same issue - so was able to replicate this issue. Might need to raise issue with HI.
-Andrew Barnes
Flow Designer London Learning Module: http://bit.ly/2ypjKUX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2018 01:47 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2022 03:41 AM
This solution will not work for Name Value, this is a bug in the snow, for other fields your solution will work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2018 02:01 PM
Seeing the same thing here. I'd say it's a bug; ServiceNow would probably say it's just not supported yet :). Either way, you can work around the issue with a client script. It uses DOM manipulation, which I know is frowned upon, but this should be a great workaround until SN fixes or supports this for this field type. Just change 'u_name_value' to the name of your field. You could also change the 'elmt.disabled' line to 'elmt.hide()' if you just wanted to remove the +/- buttons instead of disabling them.
function onLoad() {
setTimeout(readOnlyNameValue, 1000);
}
function readOnlyNameValue() {
try {
// Make the 'u_name_value' field read only
var fieldName = 'u_name_value';
var el = $('element.' + g_form.tableName + '.' + fieldName);
// Disable inputs
el.select('input').each(function(elmt) {
elmt.disabled = true;
});
// Disable buttons
el.select('button').each(function(elmt) {
elmt.disabled = true;
});
} catch(e) {}
}