How to set charge contact to an order contact?

Discussions concerning general integration topics.

Moderator: Phil Barton

Post Reply
oalkada
Posts: 1
Joined: Mon Jul 27, 2020 4:35 pm

How to set charge contact to an order contact?

Post 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];
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

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

Post 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);
Bob Richards, Senior Software Developer, SoftPro
Post Reply