How to copy record

Hello all,

I’ve been running into a frustrating problem lately regarding simple maps between records. It seems that webMethods default behavior is to create a REFERENCE between mapped records.

So, what I am running into is this sort of behavior:

  • I have a record I want to save during flow execution
  • I map the record I want to save to another record, and make modifications to that other record
  • Every modification I make to the other record is reflected in the record I wanted to save

Can anyone explain why webMethods uses this “reference” mapping … and what is the best way to implement a real copy(map)? I have read that you need to create another “copy” flow and literally copy elements from one record to the next. This seems ridiculous. TIA for any help!

-Nicholas

The behavior for mapping is for strings to be copied by value. All other data types are copy by reference. As for why it is done this way I can only speculate but undoubtedly has to do with the fact that copy by reference is what Java does and IS is written in Java. So the copy by value for strings is actually a “bonus.” :wink:

If you want to have two or more independent records, you have to make copies. To make a copy using just FLOW steps, map only string fields, never structures. Tedious but necessary. This thread provides additional discussion:
[url=“wmusers.com”]wmusers.com

With using RecordReference(example:PO_temp(PO record) )and if we make any changes in the original record(PO record) ,then it will automatically reflect changes in the mappings used by RecordReference structure.

This behaviour is very advantage in some parts and also has disadvantages to some extent, if we change some thing in the original record itself ,then it will reflect all the corresponding maps where ever the recordreferences(PO record) was used.And if we are mapping this PO info for different partners which has individual businesslogic then problem starts.