Prevent input variable value from changing

I need to know how I can prevent input variable value from changing. For example, I have service TestInputVariable with input parameter of InputDoc (document). See below structure. Inside my service, I map “Profile” to “tmpProfile”. I then use toUpper service for “tmpProfile/name”. My “tmpProfile/name” is uppercased which is the behavior I’m expecting :), but then “Profile/name” is also uppercased :confused:. How can I prevent “Profile/name” value from changing?

InputDoc Structure:

  • InputDoc
    ** Profile
    *** name
    *** message
    *** phonelist
    **** cell
    **** work
    **** home

Thanks for help!

Map at the individual field level, not the document level.

Think of this in Java terms.

java.util.HashMap a = new java.util.HashMap();
java.util.HashMap b = a;

b.put(“foo”, “bar”);

With this code, there is just one HashMap object with two variables pointing to it. Any modification through either var will be reflected in the other.

String value = a.get(“foo”); // value will be “bar”
String value2 = b.get(“foo”); // value2 will also be “bar”

When you map at the document level, you’re creating a variable that points to the same underlying document/record. To avoid that, you need to create a new record. That is done by mapping at the field level to a new document.

Hope this helps.

Thanks Rob! Your explanation helped.