Page 1 of 1

Selecting CDF Line for a HOA Charge/Proration via API

Posted: Wed Sep 13, 2017 10:09 pm
by ckootg
On the HOA Charges & Prorations screen, you can select the line the charge/proration appears on, ie., K.12/M.13. How can I do this via the API?

The CDFLine property on the HOACharge object is protected, so I can't assign that way.

I also tried assigning the charge to the CDF line:

Code: Select all

var dueFromBuyerSummaryCharge = <get charge>;
var dueToSellerSummaryCharge = <get charge>;
var lineK12 = GetLine("K.12");
var lineM13 = GetLine("K.13");
lineK12.Charges.Add(dueFromBuyerSummaryCharge);
lineM13.Charges.Add(dueToSellerSummaryCharge);

Re: Selecting CDF Line for a HOA Charge/Proration via API

Posted: Thu Sep 14, 2017 12:07 pm
by BobRichards
In the example below, I already created an endorsement and am changing the line the charge goes to. The trick is to set the "CDFLine" on the endorsement to the desired line. HUDs and Commercial (CSS) settlement types will have a different process to follow, but these are the CDF steps. Also, see the SDK for other variants of the "NextAvailableLine()" method if you need additional options.

Code: Select all

// Open CDF order - will be slightly different for CSS and very different for HUD.  
IOrderStore os = ss.GetService<IOrderStore>();
IOrderInfo orderInfo = os.Orders.Where(t => t.Number == orderNumber).First();
using (IOrder order = os.OpenOrder(orderInfo, OrderEditMode.ReadWrite))
{
	// Get the desired line from the first CDF.  If line doesn't exist, add a new one.
	IList cdfs = (IList)order.GetProperty("CDFs");
	IOrderItem cdf = (IOrderItem)cdfs[0];
	var lines = cdf.GetProperty("Lines") as IEnumerable<IOrderItem>;
	var line = lines.Where(t => (string)t.GetProperty("SectionNumber") == "H.05").FirstOrDefault();
	if (line == null)
	{
		// No line - create it.
		//  NOTE: Endorsements may only be added to Section B, C, and H by default.
		line = ((dynamic)cdf).NextAvailableLine(CDFSectionType.ServicesShoppedFor);
	}

	// Endorsement has already been created and is part of the order.
	//  Change its line property to your line.
	IOrderItem title = (IOrderItem)order.GetProperty("Title");
	IList endorsements = (IList)title.GetProperty("Endorsements");
	IOrderItem endorsement = (IOrderItem)endorsements[0];
	endorsement.SetProperty("CDFLine", line);

	// Save order.
	os.ApplyChanges(order);
}

Re: Selecting CDF Line for a HOA Charge/Proration via API

Posted: Thu Sep 14, 2017 2:51 pm
by ckootg
Thanks. That worked. Had to set the CDF line on the proration level, not charge level.

The NextAvailableLine method worked too, but I couldn't find it in the SDK help.

Re: Selecting CDF Line for a HOA Charge/Proration via API

Posted: Fri May 22, 2020 9:03 am
by patel
Hi Bob,

I know this is old topic, but can you give me an example to get next credit/debit line using NextAvailableLine(). I looked at the SDK doc but dint find anything

Thank you
Parth

Re: Selecting CDF Line for a HOA Charge/Proration via API

Posted: Fri May 22, 2020 3:25 pm
by BobRichards
Please see the topic Getting the NextAvailableLine() for your answer. I split it out since I have plans to add more settlement statment types as needed for the same functionality.

Re: Selecting CDF Line for a HOA Charge/Proration via API

Posted: Fri May 22, 2020 3:46 pm
by patel
Hi Bob,

Thanks for the reply.

I was trying to get next credit debit like for Section K and L (Like give me next available credit/debit line for those sections) or just a regular line, is this possible with above method ?

Thanks,
Parth

Re: Selecting CDF Line for a HOA Charge/Proration via API

Posted: Mon May 25, 2020 1:50 pm
by BobRichards
As a general rule, if you can't do it from the Select UI, you can't do it from the API. After reviewing the code, it appears you cannot add to sections: K, L, M, and N.