Page 1 of 1

Creating a LoanPolicy

Posted: Fri Nov 14, 2014 12:38 pm
by cbentley
I need to create a new LoanPolicy with an Exception. The loan policy type should be 'Policy - Schedules B1, B2' under TitleInsuranceCalculations.
The code I have here isn't quite enough to get it done. I don't know how to make it the 'B1, B2' policy.

dynamic title = o.Title;
IList ticalcs = (IList)title.TitleInsuranceCalculations;
dynamic tic = order.CreateNew("TitleInsuranceCalculation");
ticalcs.Add(tic);
dynamic lp = tic.LoanPolicy;

//Add Exception
IList exceptions = (IList)lp.Exceptions;
dynamic ex1 = order.CreateNew("Exception");
ex1.Text = "A new exception";

Re: Creating a LoanPolicy

Posted: Fri Nov 14, 2014 2:13 pm
by BobRichards
Loan Policy exceptions in an order are viewable in the "Policy - Schedules B1, B2" screen. If you are added exceptions to the LoanPolicy object, this is where they should show up. However, don't confuse the screen you might view order information in with the underlying location the raw information is stored in the order model.

Are the exceptions you create programmatically are not showing up anywhere in the order?

Re: Creating a LoanPolicy

Posted: Fri Nov 14, 2014 3:07 pm
by Joni Hoffman
The system will only allow you to create a Loan Policy if there is a Loan in the Order that is not currently associated to a policy.

So, the easiest way to create a new Loan Policy, is to add a new Loan to the Order which will automatically add a new Title Insurance Calculation and set the PolicyType = Loan. You can then access the new Loan Policy.

If there is a Loan in the Order that is not currently associated to a policy, you can do the following (I took your example and modified it to have the correct steps):

dynamic title = o.Title;
IList ticalcs = (IList)title.TitleInsuranceCalculations;
dynamic tic = order.CreateNew("TitleInsuranceCalculation");
ticalcs.Add(tic);
tic.PolicyType = PolicyType.Loan; // missing from the original example
dynamic lp = tic.LoanPolicy;

//Add Exception
IList exceptions = (IList)lp.Exceptions;
dynamic ex1 = order.CreateNew("Exception");
exceptions.Add(ex); // missing from original example
ex1.Text = "A new exception";

Re: Creating a LoanPolicy

Posted: Fri Nov 14, 2014 3:48 pm
by cbentley
I understand now, it's working. Thank you.

//Title Exception
dynamic title = o.Title;
IList ticalcs = (IList)title.TitleInsuranceCalculations;
dynamic tic = ticalcs[0];
tic.PolicyType = PolicyType.Loan;
dynamic lp = tic.LoanPolicy;

//Add Exception
IList exceptions = (IList)lp.Exceptions;
dynamic ex1 = order.CreateNew("Exception");
ex1.Text = "A new exception";
exceptions.Add(ex1);