Passing an object from Preprocessing BPM to Post Processing

Is it possible to pass an object from a Pre-Processing Method Directive to a Post-Processing Method Directive? I know I can use the BPMData to pass values, but what if I want to pass a Data Row?

Serialize It :slight_smile:

1 Like
1 Like

Can you serialize different data types? I am hoping to pass QuoteQtyRow.

Yeha you can serialize (pretty much anything) as long as the type is serializable… not sure if the QuoteQtyRow is… however you can also make an anonymous object and serialize it

Well, it was a lesson, I tell you what!
I was able to get it working. Here is the basics:

  1. Serial the set of QuoteQtyRow
  2. Remove the elements that I don’t need from the resultant XML
  3. Save the XML in BPMCallContext.Character01
  4. In Post Processing, deserialize the XML
  5. Use the code from an Updateable BAQ to update QuoteQty to create the template for UpdateExt (yes, I cheat)
  6. Repopulate only the fields I need (note a bunch of the fields cause a “Row has already been added to another table”) for UpdateExt
  7. Run UpdateExt
  8. Refresh the dataset

Why all this? Because the system wipes out Quote pricing if the Customer/ShipTo changes and the price list differs.

1 Like

@Jason_Woods Would you be willing to share the code examples?


There’s sample code on the referenced post… above.

Hi Jason,

I’ve been trying to get this to work with the QuoteDtlRows. I’ve done this before with an int array on another BPM and it works fine but I’m having a hard time getting it to work with objects. How did you get it to work? Can you show me some sample code? I tried putting in List of int arrays, DataSet, array of anonymous objects. I keep getting the error that says "it didn’t expect "

What are you trying to accomplish? QuoteDtlRows was not part of this requirement.

On Quote Create Order Pre-processing BPM, I’m trying to pass quote line information to the Post processing. This is kind of the idea. I’m not sure how to get this to work:

List<Erp.Tablesets.QuoteDtlRow> quoteDtl = ttQuoteDtl.Where(row => string.Equals(row.RowMod, IceRow.ROWSTATE_UPDATED, StringComparison.OrdinalIgnoreCase)).ToList();
System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(quoteDtl.GetType());
System.IO.StringWriter sw = new System.IO.StringWriter();
serializer.Serialize(sw, quoteDtl);
callContextBpmData.Character01 = sw.ToString();

I get this similar error when I try to feed it a list of different types:

Inner Exception: ArrayOfQuoteDtlRow xmlns=’’ was not expected.

Also, The code errors out on the serializer.Serialize(sw, quoteDtl); line.

Where do you need the data? Are you trying to get quote information onto the Order?

I have a custom Sequence_c Column that the user can specify on the QuoteDtl. I figured out if you update ttQuoteDtl Quote Line on this BPM, you can change the sequence of the created Sales Order without changing the original sequence of the Quote. The problem is once the order is created, the order link to the quote num/line is now messed up. And so, in the post processing, I’m trying to update the Order lines to point to the correct Quote Num/Line.

Ideally, I wanted to create an list of objects that holds QuoteNum, OriginalQuoteLine, NewOrderLine(Sequence_c) and serialize that into bpmContext.Character01.

So I am clear: You have a Quote that you are creating an Order from and you would like to re-sequence the Lines on the Order?

Yes correct

wow… It’s because I was overriding Character01 which was being used as a int serial. And when it was deserializing it, it was expecting a different type. I changed it to Character02 and it serializes properly… Thanks so much Jason