Skip to Content

How to store an ArrayList in SCP properties ?

Hey All,

I am developing an interface connecting EC with OnBoarding.

We are trying to generate multiple EmpIds using odata api - generateNextPersonId function, store them in an Array List and update multiple employees on the OnBoarding side.

Now I have generated the Ids and am able to store it in an ArrayList using Groovy scripting. Now I want to store that in the properties section so that I can access it later on.

How will I be able to do that?

I tried creating a global variable in properties section and store it. Didn't work. I can create Global variable, Local variables, Constant, Expression, Property, Header, XPath. It's weird that I cannot set the type for anything else except XPath. The Type field in the properties section gets greyed out when I select global variable. I though I could set the type as java.Util.ArrayList.

Any input will be highly appreciated.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 29, 2017 at 05:18 AM

    Hello Kriba,

    You can set the property containing ArrayList in Script itself


    import java.util.HashMap;
    def Message processData(Message message) {
        def body = message.getBody();
        List<String> list = new ArrayList<String>();
        def map = message.getHeaders();
        map = message.getProperties();
        message.setProperty("P_ArrayData", list);
        return message;

    Write Variable:

    Content Modifier to retrieve the value stored( just for testing purpose ):

    Unfortunately its not possible retrieve individual elements of ArrayList written as Property( In earlier steps ) inside Content Modifier,you have to write a script again to get the elements one by one.But you can retrieve complete list of elements stored in one shot ( as shown in Content modifier by setting the value of variable to Property and access it later.)

    Hope it helps.


    Sriprasad Shivaram Bhat

    Add comment
    10|10000 characters needed characters exceeded