DirWiz Logo

Article Tags

Custom Mapping: Javascript Mapping

2020-09-09 09:22:17
Custom Mapping Javascript UnitySync 

Attribute mapping can be enhanced by the use of Javascript. This includes scripting within your custom map files as well as via eval.js subroutines.

Below find examples of commonly used javascript mappings.

To insert country code to a telephone number

The below mapping will insert a country calling code if the Source data is missing it. In this example, we are using +44 for the UK.

NewPhone=&"^telephonenumber^".substr(0, 1) == '+' \? '^telephonenumber^' : '+44 ^telephonenumber^'&

Slice source data for specific format

The below mapping will:

  • Insert prefix ‘Emp’
  • Grab the final 4 characters of Empnr
  • Drop the / from HireDate
  • Returns result as one string

Source data:




Return value and format:


For more complex javascript commands, refer to Sample Javascript Functions. Using eval.js with custom mappings allows for more complex data manipulation.

Share this article: Twitter reddit