Things Every ServiceNow Developer Must Know

adityahubli
Giga Guru

 Things Every ServiceNow Developer Must Know :

 

1)gr.setUseEngines(false) 

: It prevents workflows, business rules, data policies, and email notifications from firing for the current GlideRecord action (insert, update, delete).ServiceNow GlideRecord API method used in server-side scripts to temporarily disable internal processing engines

Eg.

var gr = new GlideRecord('incident');
gr.get('sys_id_of_incident'); // Or query for records

gr.setUseEngines(false); // Disable engines for this operation
gr.comments = 'System update, no notification';
gr.update(); // Update happens without triggering notifications or policies
gr.setUseEngines(true); // Re-enable engines

 

2)g_form.getEditableFields()

undocumented client-side API in ServiceNow that returns an array of the names (field names) of all fields currently editable (not read-only) on the form. 

Making a complete form read-only: You can retrieve all editable fields and then loop through the array to set each one to read-only.

var fields = g_form.getEditableFields();
for (var i = 0; i < fields.length; i++) {
g_form.setReadOnly(fields[i], true);
}

 

3)Data types :

FieldName :The Field Name field type stores the column name (technical name) of a specific field from a selected table. 

TableName ;The Table Name field type stores the name of a specific table within the ServiceNow instance (e.g., incident, cmn_location, sys_user). 

It is typically used in conjunction with a Table Name field, where the available fields in the Field Name dropdown are dependent on the table selected in the Table Name field. This allows dynamic configuration of which fields to reference, for example, in report filters or integration mappings

 

adityahubli_0-1767717003374.png   

adityahubli_1-1767717095422.png

 

4)How to delete/update bulk data without scripting :

For bulk record deleting there is OOTB option that is Data management .

 Go to target table => filter out data which you want to delete ( apply OOTB filter functionality) =>Right click => In Context Menu => click on Data management => Delete with delete preview  => cascade preview => execute now ( from related links) => wait filtered out records will get deleted

 

Screenshot (1153).png

 

 update bulk records by Data management  .

Go to target table => filter out data which you want to delete ( apply OOTB filter functionality) =>Right click => In Context Menu => click on Data management => click on Update with all preview => open another forms, enter the fields value which you want to update => save form => then there is execute now related link , click it => All filtered out records will get updated.

 

Screenshot (1155).pngScreenshot (1154).png

 

 

5)Different roles required  for servicenow scripting :

client script : client_script-admin

Business Rule :business_rule_admin

fix  script : script_fix_admin

ui action : ui_action_admin

script include : script_include_admin

schedule job : schedule_admin

 

This list very useful for interviews, real projects, and best practices 😀 

 

 

 

 

 

5 REPLIES 5

Itallo Brandão
Mega Guru

Hi @Mohammed8  and @adityahubli ,

You are absolutely right, I completely overlooked that restriction regarding the global feed. Thanks for pointing it out!

However, I believe the "Create Article" option is often available for standard users if they navigate directly into a specific Group (e.g., Developer Community or a specific Product Hub) and post from there, rather than using the main global menu.

But your suggestion to prefix the title is a great workaround in the meantime.

Regards,

Brandão.

 

 

ItalloBrando_0-1767761855603.png