Create a custom processor

You can create a custom processor to execute a script from a URL query.

About this task

When complete, you will be able to:

  • Create a new processor
  • Run a script from a URL query

The following example steps assume you have your own demonstration instance.

Procedure

  1. Navigate to System Definition > Processors.
  2. Click New.
  3. For Name, enter Hello.
  4. For Type, select script.
  5. For Path, enter Hello.
  6. For Script, enter the following code.
    var name = g_request.getParameter("name");
    g_processor.writeOutput("text/plain", "Hello " + name);
  7. Click Submit.
  8. Logout of the instance and open a new browser window.
  9. Enter a URL query to the instance with the following format: https://instance.service-now.com/processor_name.do?parameter=value. For example: https://<instance name>.service-now.com/Hello.do?name=world.
  10. When prompted, enter credentials for valid user.