Category: Interview Questions
Updated on: September 29, 2025  |  0

Interview Questions GRIND 20

πŸš€ ServiceNow Interview Questions Grind


Q1: How to set the default value of a Date/Time field to the current date-time?

πŸ‘‰ Answer:
Go to the Dictionary of the respective Date/Time field and set the default value as:

Β 
javascript:gs.nowDateTime();

πŸ’‘ Pro Tip: Use this when you want a field to auto-populate with the current time (e.g., β€œOpened At”).


Q2: What is Client Transaction Timing?

πŸ‘‰ Answer:
Client Transaction Timing provides detailed information ⏱️ on the duration of transactions between the client and the server.

πŸ“Œ Requirement: Activate the plugin β†’ Client Transaction Timing Plugin.

πŸ’‘ Use Case: Helpful in performance troubleshooting.


Q3: What does theΒ setWorkflow(e) function do?

πŸ‘‰ Answer:

  • setWorkflow(true) β†’ Enables business rules, workflows, and auditing (default).

  • setWorkflow(false) β†’ Disables business rules and auditing for that operation.

πŸ“Œ Example:

Β 
current.setWorkflow(false); current.update();

πŸ‘‰ This updates the record without triggering business rules.

⚠️ Interview Hint: Useful when updating records in bulk without triggering unnecessary rules.


Q4: What does theΒ setForceUpdate() function do?

πŸ‘‰ Answer:
Forces the record to be updated even if no fields were changed.

πŸ“Œ Example:

Β 
current.setForceUpdate(true); current.update();

πŸ’‘ Pro Tip: Handy when you want to fire business rules or workflows even if the record data didn’t change.


Q5: What is the significance of theΒ setLimit(n) function?

πŸ‘‰ Answer:
setLimit(n) restricts the number of records returned by a GlideRecord query.

πŸ“Œ Example:

Β 
var gr = new GlideRecord('incident'); gr.setLimit(5); gr.query();

πŸ‘‰ Returns only 5 incidents.


Q6: How to get the row count in a GlideRecord?

πŸ‘‰ Answer:
Use the getRowCount() function.

πŸ“Œ Example:

Β 
var gr = new GlideRecord('incident'); gr.query(); gs.info("Total rows: " + gr.getRowCount());

Q7: What is the difference betweenΒ deleteMultiple() and deleteRecord()?

πŸ‘‰ Answer:

  • deleteMultiple() β†’ Deletes multiple records matching the current query (but does not delete attachments).

  • deleteRecord() β†’ Deletes a single record (including its attachments).

πŸ“Œ Example:

Β 
// Delete all P1 incidents var gr = new GlideRecord('incident'); gr.addQuery('priority', 1); gr.query(); gr.deleteMultiple();

πŸ’‘ Pro Tip: Use deleteMultiple() carefully ⚠️ β€” it’s powerful and can wipe out large data sets quickly.

Comments

No comments yet.


Log in to post a comment