getEditableFields(): not getting this method for g_form

Shivani29
Mega Guru

Hi All,

in Madarid, i had a g_form method named getEditableFields() , but now I am trying to write the script in NewYork but this method is not available... Is it correct or I am doing something wrong. Please help!!

Script in Madarid:

 

var stat=g_form.getValue('state');

if(stat =='8' || stat=='10' || stat== '11'){
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);

 

Regards,

Shivani Malhan

 

1 ACCEPTED SOLUTION

AbhishekGardade
Giga Sage

You doing it correctly.  Its normal behavior. g_form wont show you this method getEditableFields().

 

EDIT:

ServiceNow doesn't include everything in their documentation for some reason or another. Maybe they know they might change a functionality or something. Who knows except for them. However, it doesn't mean that that information isn't available.

If you definitely know of a function or method exists and there is no documentation on it, sometimes you can render a form or a ServiceNow page and use the "Inspect element" of the browser tools to gather some info.

Note: This doesn't work 100% of the time:

Please mark as Correct Answer and Helpful, if applicable.

Thanks!
Abhishek Gardade
Hexaware Technologies

Thank you,
Abhishek Gardade

View solution in original post

2 REPLIES 2

AbhishekGardade
Giga Sage

You doing it correctly.  Its normal behavior. g_form wont show you this method getEditableFields().

 

EDIT:

ServiceNow doesn't include everything in their documentation for some reason or another. Maybe they know they might change a functionality or something. Who knows except for them. However, it doesn't mean that that information isn't available.

If you definitely know of a function or method exists and there is no documentation on it, sometimes you can render a form or a ServiceNow page and use the "Inspect element" of the browser tools to gather some info.

Note: This doesn't work 100% of the time:

Please mark as Correct Answer and Helpful, if applicable.

Thanks!
Abhishek Gardade
Hexaware Technologies

Thank you,
Abhishek Gardade

Shivani29
Mega Guru

Hi Abhishek,

 

Thanks for the prompt response. I tested and working.

 

Regards,

Shivani Malhan