Custom Mapping: Javascript functions for eval.js (Custom)

Created: 2025-12-05 09:19:23
Modified: 2025-12-05 10:54:50
Tags: Custom Mapping Javascript

This was a custom solution for a customer who had inconsistent source data making up first, last, middle, pronouns, preferred names, et al. Written to their specifications, we parsed the incoming attributes to set destination attributes as required.

Custom attribute mappings call functions in the custom eval.js file.


Custom Object Map: FindName


SourceCN=^cn^  
SourceDisplayname=^Displayname^  
SN=&getsn()&  
FIRSTNAME=&getfirst()&  
NewDISPLAYNAME=&getdisplayname()&  
source-displayname=^displayname^   
parsed-pronouns=&getpronouns();&  
CustPronouns=^CustPronouns^  
initials#1=^CustLegalMiddleName^  
CustLegalSN=^CustLegalSN^  
CustLivedSN=^CustLivedSN^  
CustLivedFirstName=^CustLivedFirstName^  
CustLegalFirstName=^CustLegalFirstName^  
Parsed-givenname=~givenname~   
Parsed-sn=~sn~  
Description=^description^  

Custom \UnitySync\global\eval.js.txt


function getdisplayname()

{  
var first=getfirst();  
var last=getsn();  
var initials=getsrc('CustLegalMiddleName');  
var pronouns=getpronouns();  
var dn="";  

if (initials !== undefined)  
    {dn = last + ", " + first + " " +   initials.charAt(0);}  
else  
     {dn = last + ", " + first;}  

if (pronouns !== undefined)  
{return dn + " " + pronouns}  
else return dn;  

}  //end getdisplayname()

function getpronouns()

// Find pronouns in source displayname.     
// Else look in source cn  
{  
var custompronouns=getint('custom');  
var sourcecn=getsrc('cn');    

if (custompronouns !== undefined)  
    {return custompronouns}  

var cnPro="";  

if (sourcecn.match(/\(([^)]+)\)/) !== null)
   return {sourcecn.match(/\(([^)]+)\)/)[0];}  

//no value returned if cn does not contain (pronouns)
}   //end getpronouns()

function getsn()

{
var Ssn = getsrc('sn');
var Isn = getint('sn');

var SCustLivedSN = getsrc('CustLivedSN');
var SCustLegalSN = getsrc('CustLegalSN');

if (SCustLivedSN !== undefined) {return SCustLivedSN}
    else if (SCustLegalSN !== undefined) {return SCustLegalSN}
       else {return Isn}  //Internal variable parsed from source displayname
} //end getsn()

function getfirst()

{
var Sfirst = getsrc('givenname');
var Ifirst = getint('givenname');

var SCustLivedFirstName = getsrc('CustLivedFirstName');
var SCustLegalFirstName = getsrc('CustLegalFirstName');


if (SCustLivedFirstName !== undefined)  
    {return SCustLivedFirstName}  

else if (SCustLegalFirstName !== undefined)   
   {return SCustLegalFirstName}  
else 
    {return Ifirst}

return "none";
}  //end getfirst()  

Custom \Global\Custom.txt


(he/him)  
(he/they)  
(she/her)  
(she/they)  
(they/them)  
(e/em/eirs)  
(fae/faer/faers)  
(per/pers)  
(x/xem/xyrs)  
(ze/hir/hirs)  
(ze/zir/zirs)  
Knowledgebase

Directory
  1. Directify - Self Service

  2. UnitySync - Sync
Password
  1. emPass - Sync
Obsolete
  1. Profiler
  2. SimpleSync