We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Interview Question for ServiceNow Developer | 3-6 Years Experience

MohammadAtR
Tera Contributor

Hi There,

 

Recently I attended interview for ServiceNow Developer and the question which I faced are:

1. Set Incidents as inactive if Problem is closed.

2. Types of Business Rule and explain each.

3. Types of Client Script and explain each.

4. What is GlideAjax?

5. Define UI Policy and Data Policy.

6. Any Recent Integration.

7. Types of Authentication?

8. How to Setup OAuth?

9. What is g_scratchpad?

10. Types of Error Codes & Success Code?

11. ACL order of execution?

12. How to call flow from script?

13. Move attachment internally in ServiceNow

14. Send Attachment through outbound REST integration

15. Types of Transform Script?

 

Please mark this as helpful if it helped you in your interview preparation.

3 REPLIES 3

MohammadAtR
Tera Contributor
  1. Set Incidents as inactive if Problem is closed.

Ans. var prb = new GlideRecord('problem');

prb.addQuery('active',false);

prb.query();

while(prb.next()) {

    gs.print("Processed Problems "+prb.number);

    var inc = new GlideRecord('incident');

    inc.addQuery('problem_id',prb.getUniqueValue());

    inc.addActiveQuery();

    inc.query();

    while(inc.next()) {

        gs.print(inc.number);

        inc.state=7;

        inc.close_notes='Closed in association with '+prb.number;

        inc.close_code='Closed';

        inc.update();

    }

}

  1. Types of Business Rule and explain each.

Ans.

Type

When it runs

Primary Use Case

Before

After clicking save, before the database update.

Validating data or auto-filling fields on the current record.

After

After the database update is committed.

Updating related records (e.g., closing child tasks).

Async

In the background (queued) after the save.

Heavy integrations or calculations that shouldn't slow the user down.

Display

When the form loads.

Passing server data to the client via g_scratchpad.

Query

Before a list or glide is fetched.

Data security (restricting which records a user can see).

  1. Types of Client Script and explain each.

Ans.

Type

When it runs

Primary Use Case

onLoad

When the form first opens.

Setting initial field visibility, read-only status, or messages.

onChange

When a specific field changes.

Updating field B based on what the user typed in field A.

onSubmit

When the user clicks Save/Submit.

Final validation to stop the save if data is incorrect.

onCellEdit

In a List View (double-click).

Controlling or preventing changes made from the list.

 

  1. What is GlideAjax?

Ans. GlideAjax is a ServiceNow class that allows a Client Script to call Server-Side code (a Script Include) and get data back without refreshing the page.

It is the standard, high-performance way to bridge the gap between the browser and the database.

  1. Define UI Policy and Data Policy.

Ans. A UI Policy runs client-side in the browser to make fields mandatory, read-only, or hidden on the form. However, because it only exists on the front end, it can be completely bypassed by integrations or data imports. A Data Policy, on the other hand, runs server-side to protect the database. It enforces mandatory and read-only rules no matter how the data enters the system

  1. Any Recent Integration.

Ans. Walkthrough any recent integration on PDI but interviewer expects real world scenario.

  1. Types of Authentication?

Ans. Basic and OAuth 2.0

  1. How to Setup OAuth?

Ans. > Ensure OAuth 2.0 plugin is installed and check ‘sys_properties.list’ has ‘com.snc.platform.security.oauth.is.active’ is true

> System OAuth->Application Registry->New

  1. What is g_scratchpad?

Ans. g_scratchpad is an OOB JavaScript object in ServiceNow that passes data from the server to the client during form load, without requiring a GlideAjax Call.

  1. Types of Error Codes & Success Code?

Ans.

> 200 – OK (Request Succeeded)

> 201 – Created (New resource created)

> 204 – No Content (No Content to return)

> 400 – Bad Request (Server could not understand the request)

> 401 – Unauthorized (Invalid credential)

> 404 – Not Found(Requested resource could not be found)

> 500 – Internal Server Error

  1. ACL order of execution?

Ans.

  1. Table-level ACL Evaluation: The system first checks for ACLs on the entire table.
  2. Record-level ACL Evaluation: Ater the table ACLs, the system evaluates record specific ACLS.
  3. Field-level ACL Evaluation: Finally, the system checks the field specific ACLS for any restrictions on individual fields.
  4. How to call flow from script?

Ans. Depends on synchronous or asynchronous calls,

“sn_fd_FlowAPI”

Synchronously:

>sn_fd_FlowAPI.executeFlow(flow name,inputs)

>sn_fd_FlowAPI.executeSubFlow(subflow name,inputs)

>sn_fd_FlowAPI.executeAction(action name,inputs)

Asynchronously:

>sn_fd_FlowAPI.startFlow(flowname,inputs)

>sn_fd_FlowAPI.startSubFlow(subflow name,inputs)

>sn_fd_FlowAPI.startAction(action name,inputs)

Example, execute a global flow called ‘test_flow’, then sn_fd.FlowAPI.executeFlow(‘global.test_flow’,inputs);

  1. Move attachment internally in ServiceNow

Ans. Use GlideSysAttachment()

Example,

var att = new GlideSysAttachment();

var incsys = “some sys_id of inc”;

var inc = new GlideRecord(‘incident’);

inc.get(incsys);

var copyAtt = att.copy(‘incident’,incsys,’problem’,inc.getValue(‘problem_id’);

  1. Send Attachment through outbound REST integration

Ans. Using /now/attachment/file in POST

Uploads specific binary file as an attachment to a specific record.

  1. Types of Transform Script?

Ans.

>onStart

>onAfter

>onBefore

>onChoiceCreate

>onComplete

>onForeignInsert

>onReject

 

Please mark this as helpful if this helped you in your interview preparation.

All the best!

slight formatting issue it seems

suraj sengar
Mega Guru

@MohammadAtR - Thanks for sharing valuable information.