Skip to Content
0

How to store the data in Hash map by using groovy script?

Jan 05, 2017 at 10:30 AM

124

avatar image
Former Member

We have a requirement to fetch the data from SuccessFactor and store it into hashmap.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Sriprasad Shivaram Bhat Jan 10, 2017 at 04:25 PM
0

Hello Aditya,

Could you please elaborate more on your requirement .Do you want to store the list of values coming in message mapping queue in ArrayList in message mapping or something else?

Regards,

Sriprasad Shivaram Bhat

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 11, 2017 at 10:24 AM
0

Hi Sriprasad,

Thanks for Reply.

I am fetching the compound employee data from SuccessFactor and want to store the person_id_external into HashMap ArrayList .

Actually for validation purpose i am storing value into HashMap.

Share
10 |10000 characters needed characters left characters exceeded
Aditya Sharma May 09 at 11:53 PM
0

Hello Namesake :),

Note sure whether this query was closed, if not, please refer the below snippet to make use of the HashMaps in CPI using Groovy scripting.

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
HashMap myHashMap = new HashMap<String,String>();
def pIdExternal = person_id_external; // this is the value you have received from parsing the incoming XML using Groovy Scripting.
myHashMap.put("MyKey_thisCanBePersonIdExternal","MyValue_thisCanBeAnyValueYouWantToStoreAgainstPIDExternal");

message.setProperty("myHashMap", myHashMap); return message; }

This hashmap and subsequent updates can be accessed via property call from any of the following nodes, even in branches with Parallel / Sequential multicasts.


Thanks,

Aditya

Share
10 |10000 characters needed characters left characters exceeded
Aditya Sharma May 09 at 11:53 PM
0

Hello Namesake :),

Note sure whether this query was closed, if not, please refer the below snippet to make use of the HashMaps in CPI using Groovy scripting.

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
HashMap myHashMap = new HashMap<String,String>();
def pIdExternal = person_id_external; // this is the value you have received from parsing the incoming XML using Groovy Scripting.
myHashMap.put("MyKey_thisCanBePersonIdExternal","MyValue_thisCanBeAnyValueYouWantToStoreAgainstPIDExternal");

message.setProperty("myHashMap", myHashMap); return message; }

This hashmap and subsequent updates can be accessed via property call from any of the following nodes, even in branches with Parallel / Sequential multicasts.


Thanks,

Aditya

Share
10 |10000 characters needed characters left characters exceeded