logo

NJP

3 Mistakes I Made as a New ServiceNow Developer

Import · Apr 20, 2021 · article

Many out-of-the-box choices (like the state field on the Incident record) have numeric values. The number value is what is saved to the database when you save a record with a particular state choice.

image

If you want to change the order in which the choices are listed, update the Sequence of the choice, not the Value.

image

Forgetting to include data referenced by a configuration

Example: If you created a group in your development instance that you reference in a configuration (eg. an Assignment Rule), then you need to include the group in your deployment to production.

image

If you forget to include the group, the configuration will not work as expected. Remember, the group does not yet exist in production.

In most cases, the configuration (eg. the Assignment Rule) will refer to the group’s sys_id. So creating a group in production with the same name will not solve this problem.

Ways to include a group (or any data not captured in your update set/application filesimage

  • If you are working with a scoped application, you can create application files to include data.
  • If you are working in the global scope, you can add the data in a couple of ways:
    1. Export the data (eg. the group record) via XML and import it into production so that the sys_id remains the same, since it is referenced in your configuration.
    2. Add the data to your update set, via this background script:
      var updateEntry = new GlideRecord('[TABLE]'); updateEntry.get('[sys_id]'); var update = new GlideUpdateManager2(); update.saveRecord(updateEntry);​

Adding configurations to the wrong update set

This is a problem that happens to ServiceNow developers of all levels, including expert developers.

Here are some things that might help:

image
* Be careful when changing update sets in the same session but a different windows.Example: When you have multiple Chrome browser tabs open and you change the selected update set in one tab and forget to refresh the other tab. It would still show whatever update set you had selected when you loaded the tab but any changes you save would be made to the update set you most recently selected!
* Check update set entries religiously. This is a habit that I’ve gotten into that has been helpful for me. When I do development, I will often check the Customer Updates [sys_update_xml] list (https://INSTANCE.service-now.com/nav_to.do?uri=%2Fsys_update_xml_list.do) to verify that the changes I’m making are being saved, and put into the correct update set.
* Tools, utilities, How-to guides - To re-iterate that this isn’t just a problem for new developers, there are various tools, utilities, and how-to guides that have sprung up from developers of all levels who have had to deal with this issue. Here are just a few examples to get you started:

* Update Relocator by @Tim Woodruff/The SN Guys

* Move to another update set by @andersfigenschow

* Look at the various utilities provided on the Share site and you will see several that deal with update set management including this issue AND the one above.

If you have other tools, tips, or links to how-to guides for Update Set management, please feel free to add them in the comments.

If you found this imagehelpful, please mark it as such below image

View original source

https://www.servicenow.com/community/developer-articles/3-mistakes-i-made-as-a-new-servicenow-developer/ta-p/2330022