john_roberts
Mega Guru

So I finally started a community blog for those rare instances when I actually have a focused thought that breaches 140 characters.


Now what was I doing.... Oh yeah, here's something that's been queued up for a while since I've had a number of requests after I first mentioned it at Knowledge11.
How do I integrate my work in ServiceNow (problems, enhancements, SCRUM stories, and other tasks) with my development environment, Eclipse?

As soon as I discovered Mylyn (a task management plugin for Eclipse), I thought it would be great to have ServiceNow tasks appear in my workspace. At first, I thought I was going to have to build a dedicated Mylyn connector. Thankfully it turned out to be quite a bit easier.
Mylyn has an experimental (incubator) connector for requesting and parsing web data. All I had to do was figure out was how to define the request and parsing. Next thing I knew, tasks were showing up in Eclipse and I'm high-fiving the dogs (side-effect of working from home).
Here's a demonstration of the configuration and basic usage.

There's so much more you can do once it's setup. Here's the scope of what I'm using it for.


  • Multiple queries to distinguish work type

  • Creating new records

  • Searching tasks

  • Linking file changes with tasks to automatically create worksets with check-in comments generated from the task's short description

Parameters used in video (to save you some typing)
  • Task URL:

    ${serverUrl}/${table}.do?sysparm_query=number=${Id}
  • New Task URL:

    ${serverUrl}/problem.do?sys_id=-1
  • Query Request URL:

    ${serverUrl}/${table}.do?&sysparm_query=${query}&XML&useUnloadFormat=true
  • Query Pattern:

    <number>({Id}.+?)</number>.*?<short_description>({Description}.+?)</short_description>.*?<sys_class_name>({Type}.+?)</sys_class_name>

The query pattern uses regular expresssions to parse the information we want from the task record XML. Since field names are sorted alphabetically, so should your expressions.
In this example we are mapping the task number to Mylyn ID, short_description to description, and class name to type (useful when querying for all my work from the task table).
If you are querying tasks that aren't assigned to you, you can add

<assigned_to display_value="({Owner}.+?)">.*?
at the beginning to also map the assigned to display value to the owner field. This is where the useUnloadFormat parameter comes into play. It tells the XML processor to include display values for reference fields.

Demo was made using the following:

1 Comment