Creating a LoanPolicy

Discussions related to order tracking development with the ProForm module.

Moderator: Phil Barton

Post Reply
cbentley
Posts: 13
Joined: Tue Nov 11, 2014 3:08 pm

Creating a LoanPolicy

Post by cbentley » Fri Nov 14, 2014 12:38 pm

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";

BobRichards
Posts: 1006
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Creating a LoanPolicy

Post by BobRichards » Fri Nov 14, 2014 2:13 pm

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?
Bob Richards, Software Developer, SoftPro

Joni Hoffman
Posts: 18
Joined: Fri Oct 03, 2008 1:12 pm

Re: Creating a LoanPolicy

Post by Joni Hoffman » Fri Nov 14, 2014 3:07 pm

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";
Joni Hoffman
Software Developer
SoftPro

cbentley
Posts: 13
Joined: Tue Nov 11, 2014 3:08 pm

Re: Creating a LoanPolicy

Post by cbentley » Fri Nov 14, 2014 3:48 pm

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);

Post Reply