10-04-2019 5:01 PM - edited 02-03-2024 5:14 PM
Dear exports,
I am using the CPI to get data from the SF.But I am trying to combine some message of the same employee.
Now I am getting the data of the entity "PerPhone",and it returned me the record like below, each person's each phone number is one record.And some employees may have two business phone numbers, and it will return two records to me.But I want to combine them like into a same record and split the phone number with the ",".Just like below.
original return phone number(assume the employee have two business phoneNumbers):
the format I hope it looks like:
{
"emp_id":"Test_Import",
"Business":
{ "phoneNumber1","phoneNumber2"},
.....
}
Any Suggestions will be appreciated!!
Regards,
Christy.
Hi alltan_7099 ,
I would suggest to write a GroovyScript which parses and merges the nodes. Use the JSONSlurper to parse the JSON nodes: http://groovy-lang.org/json.html
The iterate via ...each{ node -> /* your merge logic */ } over all nodes. If you find a node with an "emp_id" which you already have seen, read the number, merge it to the already known node and delete the current node.
By the way - the target format should look like:
{
"emp_id":"Test_Import",
"Business": ["phoneNumber1","phoneNumber2"],
...
}
(With [ ] instead of { }, because arrays have to be declared with [].)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.