Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

SAP success factor attribute mapping with array value

musthak
New Contributor
New Contributor
Hi,
 
We have an attribute for personal email address in SAP which has multiple value and comes through below mapping
empInfo.personNav.emailNav.results[...].emailAddress
example: empInfo.personNav.emailNav.results[0].emailAddress = email address1
empInfo.personNav.emailNav.results[1].emailAddress = email address2
empInfo.personNav.emailNav.results[2].emailAddress = email address3
etc.
 
But they are random and  I want to map them based on email type
 
 
 
"emailNav": {
 
                            "results": [
                                {
                                    "__metadata": {
                                        "uri""https://random.sapsf.com:443/odata/v2/PerEmail(emailType='67452',personIdExternal='i10149')",
                                        "type""SFOData.PerEmail"
                                    },
                                    "emailType""67452",
                                    "emailAddress""test@iehp.org"
                                },
                                {
                                    "__metadata": {
                                        "uri""https://random:443/odata/v2/PerEmail(emailType='67454',personIdExternal='i10149')",
                                        "type""SFOData.PerEmail"
                                    },
                                    "emailType": "67454",
                                    "emailAddress": "Poornima12@test.com"
                                }
                            ]
 
 
want to get email address based on email type, How can I get this data? Can you provide an example Json to do so.
 
our current mapping:
"customproperty8": "empInfo.personNav.emailNav.results[1].emailAddress~#~char",
  "SECONDARYEMAIL": "empInfo.personNav.emailNav.results[2].emailAddress~#~char",
Is not working as expected, as in, result[0] can get personal email address or other email address from the api. same with result[1] and hence we want to map based on email type.
2 REPLIES 2

Darshanjain
Saviynt Employee
Saviynt Employee

Try using the Constant method mapping , for cp15 below is one example

"customproperty15":"#CONST#${try{r=response.empInfo.personNav.emailNav.results.find{it.emailType=='310'}.emailAddress}catch(e){''}}~#~char",

this is working thanks . we used this as below 

"SECONDARYEMAIL":"#CONST#${try{r=response.empInfo.personNav.emailNav.results.find{it.emailType=='67454' || it.emailType=='67453'}.emailAddress}catch(e){''}}~#~char",