cancel
Showing results for 
Search instead for 
Did you mean: 

Error Mapping using JSON

former_member740482
Participant
0 Kudos

Dear Experts.

I am trying of make a mapping using Groovy for this iflow:

This is source code

And this is the input in format JSON:

However this not work .

What is the cause of this?

And how can split the field email in two parts, example:

field1: sama.cristo

filed2: domainCompany,com

Regards

Accepted Solutions (1)

Accepted Solutions (1)

PriyankaChak
Active Contributor
0 Kudos

partytecnico74

Hi, can you please accept the answer and close the thread?

Answers (1)

Answers (1)

PriyankaChak
Active Contributor
0 Kudos

Hi,

Try with the below code.

import com.sap.gateway.ip.core.customdev.util.Message;

import groovy.json.JsonSlurper

def Message processData(Message message) {

def body = message.getBody(String)

def request = new JsonSlurper().parseText(body)

def row = ""

def splits

request.each { data ->

row += data.countryofBirth

row += ';'

row += data.personalInfoNav.perPersonal.gender

row += ';'

row += data.personalInfoNav.perPersonal.firstName

row += ';'

row += data.personalInfoNav.perPersonal.lastName

row +=';'

splits = data.email.split('@')

row += splits[0]

row +=';'

row += splits[1]

row += '\n'

}

message.setBody(row)

return message;

}

Regards,

Priyanka