Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Transform Map onStart event scripts can no longer declare global variables - Known Error
  • >
  • Knowledge Base
  • >
  • Known Error (Knowledge Base)
  • >
  • Transform Map onStart event scripts can no longer declare global variables
KB0676967

Transform Map onStart event scripts can no longer declare global variables


7087 Views Last updated : Jan 28, 2024 public Copy Permalink
KB Summary by Now Assist

Description

Since Geneva, Transform Map 'onStart' event scripts can no longer declare global variables across the transform event scripts.
Objects that are initialized in OnStart events of Transform Map are not available further down in other events of mapping.
Imports fail with the following error:

"transformRun" is not defined.
 
Since the function has been added to the transform map event scripts, for example: 
 
(function runTransformScript(source, map, log, target /*undefined onStart*/) { } 
 

Steps to Reproduce

The scenario described in the obsolete Geneva documentation on this, to declare the LDAP utils in an onStart and onAfter, does not work any more.

Ref.:
https://docs.servicenow.com/integrate/ldap/concept/c_OnStartAndOnAfterScripts.html

You can no longer declare variables in an onStart that can be read in another transform map event script , for instance an onBefore or onAfter. You now have to run what you used to run in the onStart in the onAfter.

 

Workaround

This is expected behaviour. A runTransformScript function template has been added for scripts in the new Transform Event Script record form. The recommended practice is to not use global variables inside transform map event scripts. If global variables are needed, they can be declared outside function template and passed in, and the previous template will have to be removed.

Useful documentation: 

Map with transformation event scripts

PRB633362/KB0676966: The [error] variable does not persist in an [onAfter] script in transform map.

PRB633363/KB0595652: [action] variable is not available in [field map] script in transform map in Fuji

 


Related Problem: PRB669502

The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.