DirWiz Logo
Knowledgebase

Article Tags

Custom Mapping: Add SMTP/smtp proxyaddresses at Sync time

2019-09-18 10:00:16
Active Directory Custom Mapping Exchange 20xx Javascript UnitySync 

Syncing to an Active Directory (AD) Destination, the default mapping for proxyaddresses (shown below) will sync all Source SMTP/smtp addresses. The corresponding contact created on the Destination will contain all these same addresses. This default is usually all that is needed for a typical directory sync.

proxyaddresses=[proxyaddresses]

We do recommend that you use Address Policies whenever possible as they offer more flexibility in the address format being created. Though these address policies are typically enabled, it’s possible you may need to enable them at sync time. Instructions for this are available in our knowledge base.

Occasionally, there might be the need to add an additional single smtp address on the Destination contact.

  • Leave the default mapping in place.
  • Add the below mapping. This will take the primary smtpname and append the domain name specified to add a single smtp address.

proxyaddresses=smtp:~smtpname~@NewDomain.com

Rarely, there may be a need to add another smtp address (with the same domain) based on ALL Source smtp addresses. This is possible via a custom mapping that calls an eval.js javascript sub routine.

Example Scenario:

Source values are:

  • proxyaddresses: SMTP:maryjanemmm@domain.com
  • proxyaddresses: smtp:maryjanesmith@other.com

Desired Destination values are:

  • proxyaddresses: SMTP:maryjanemmm@domain.com
  • proxyaddresses: smtp:maryjanesmith@other.com
  • proxyaddresses: smtp:maryjanemmm@TheNewDomain.com
  • proxyaddresses: smtp:maryjanesmith@TheNewDomain.com

IMPORTANT NOTE: The first two sync directly from the Source, while the second two are created at sync time from the Source values and the desired domain.

The solution for this includes a custom mapping which calls a javascript function:

  1. In a custom object map file, leave the default mapping as-is
  2. Add a new line with this additional mapping for proxyaddresses:

    proxyaddresses=smtp:&grabproxy('[allmail]')&@TheNewDomain.com

  3. Per this article, edit the eval.js file to add this sub routine:

    function grabproxy(proxies)  
    {  
    names = proxies.split("@");  
    return names[0];  
    }
    
Share this article: Twitter reddit