top of page

Remove Hard-Coded Instance URL

Hard-coded instance URLs create migration challenges when moving configurations between environments, leading to broken links and inconsistent behaviour. This reduces flexibility and can cause issues when deploying changes across development, test, and production instances.


Resolution Steps

  1. Remove Hard-Coded URLs

    • Avoid using full instance URLs such as https://dev12345.service-now.com/incident.do.

    • Hard-coded URLs break when migrating configurations between environments.

  2. Use Relative Paths

    • Instead of full URLs, use relative paths such as /incident.do.

    • This ensures that the script works across all instances without modification.

  3. Retrieve Instance URL Dynamically

    • Use gs.getProperty('glide.servlet.uri') to get the instance URL dynamically.

    • This allows the script to adapt automatically to different environments.


Before:

Avoid hardcoded instance URLs
Avoid hardcoded instance URLs

After:

    Instead, use the property 'glide.servlet.uri'
Instead, use the property 'glide.servlet.uri'

Removing hard-coded instance URLs improves flexibility, prevents migration issues, and ensures scripts function correctly in all environments. Using relative paths or dynamically retrieving the instance URL ensures maintainability and consistency.


For more detailed guidance on resolving this issue, please contact us at support@dt-advisory.ch.

bottom of page