Page 1 of 1

How to set charge contact to an order contact?

Posted: Mon Jul 27, 2020 4:37 pm
by oalkada
IList agent13 = (IList)order.GetProperty("CDFs");
IOrderItem a13 = (IOrderItem)agent13[0];

IList agent14 = (IList)a13.GetProperty("Lines");
IOrderItem a14 = (IOrderItem)agent14[18];

IList agent15 = (IList)a14.GetProperty("Charges");
IOrderItem a15 = (IOrderItem)agent14[0];

Re: How to set charge contact to an order contact?

Posted: Mon Jul 27, 2020 5:24 pm
by BobRichards
Here is an example of changing the contact associated with the first charge on Line H.01. We will need to look up ahead of time to see that section "H" corresponds to the CDF section "OtherCostSection". You will need to do this type of mapping for both CDF and indirectly in CSS settlements.

For our example, find the first underwriter and have it ready for our charge contact. (Yes. I'm assuming there is at least one underwriter in the order.)

Code: Select all

IList contacts = (IList)order.GetProperty("Underwriters");
IOrderItem underwriter = (IOrderItem)contacts[0];
Navigate to the charge from the top level order.

Code: Select all

IList CDFs = (IList)order.GetProperty("CDFs");
IOrderItem cdf = (IOrderItem)CDFs[0];

// Get section then line.
IOrderItem section = (IOrderItem)cdf.GetProperty("OtherCostSection");
IList lines = (IList)section.GetProperty("Lines");
IOrderItem line = (IOrderItem)lines[0];

// Get first charge and set it to our contact.
IList charges = (IList)line.GetProperty("Charges");
IOrderItem charge = (IOrderItem)charges[0];
charge.SetProperty("Contact", underwriter);