Things Every ServiceNow Developer Must Know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
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
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
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.
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 😀
- 374 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi Aditya,
Great content! These are valuable tips for developers.
Since this is knowledge sharing rather than a query, I highly recommend reposting this as an Article. Articles are better suited for long-term reference and ensure your tips don't get lost among open questions.
Thanks for the contribution!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hello @Itallo Brandão ,
Thanks. I’m not getting the “Article” option. Whenever I try to post an article, it gets posted as a question instead.
Regards,
Aditya,
Technical consultant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited yesterday
Article and blog posting option available for Rising stars, MVPs currently. What you can do is prefix word article/blog in your heading to differentiate question from article/blogs
Regards,
Mohammed Zakir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
