The Zurich release has arrived! Interested in new features and functionalities? Click here for more

performance considerations or common pitfalls to watch out for?

eva753kimso
Kilo Explorer

Hi everyone,

 

Are there any performance considerations or common pitfalls to watch out for?

1 REPLY 1

M Iftikhar
Mega Sage

Hi Eva,

Great question! Yes, there are several performance considerations and common pitfalls to keep in mind when working with ServiceNow:


 Performance Considerations

  • Avoid Unnecessary GlideRecord Queries

    • Always query on indexed fields (e.g., sys_id, number).

    • Use .addQuery(), .setLimit(), and only return required fields.

    • Avoid getRowCount() on large tables; use aggregate queries or pagination.

  • Use Asynchronous Processing

    • Heavy logic should run via Scheduled Jobs, Events, or Flow Designer background actions, not synchronously in Business Rules.

  • Leverage Caching

    • Use out-of-box caching mechanisms (e.g., GlideAggregate, session storage) for data that doesn’t change often.

  • Minimize Client–Server Calls

    • Bundle data in a single GlideAjax call rather than making multiple round trips.

  • Optimize Related Lists & Forms

    • Limit rows in related lists (100+ can slow pages).

    • Reduce excessive onLoad/onChange Client Scripts or UI Policies.


Common Pitfalls to Avoid

  • Editing OOB Objects

    • Avoid modifying OOB Business Rules, ACLs, or Tables. Clone or extend instead, keeps upgrades safe.

  • Unoptimized Scripts

    • Nested loops or excessive gs.info() logging inside frequently triggered Business Rules can slow performance.

  • Complex ACL Scripts

    • Overly heavy ACL logic increases both performance cost and maintenance overhead.

  • Unrestricted Scheduled Jobs

    • Large jobs running in production during peak hours can impact instance health. Break them into smaller chunks or run off-peak.

  • Skipping Sub-prod Testing

    • Always test heavy queries or logic in a sub-production instance with realistic data before deploying to prod.


Best Practice:

  • Use indexed queries + caching for efficiency.

  • Run heavy logic asynchronously instead of inline.

  • Keep scripts modular and lightweight.

  • Always test in sub-production and use System Diagnostics/Performance Dashboard to identify bottlenecks.


Hope this helps!
Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it helpful & accept the solution so others can benefit as well.