Encompass – code removes the opportunity information from every Borrower Contact

The following code removes the opportunity information from every Borrower Contact for which the current mortgage rate is less than 4%.

using System;
using System.Collections;
using System.IO;
using System.Threading;
using EllieMae.Encompass.Client;
using EllieMae.Encompass.BusinessObjects;
using EllieMae.Encompass.BusinessObjects.Contacts;

class ContactManager
{
public static void Main(string[] args)
{
// Open the session to the remote server
Session session = new Session();
session.Start(“myserver”, “mary”, “maryspwd”);

// Create the query criterion to find all borrowers with an opportunity who
// have a current mortgage rate of less than 4%.
NumericFieldCriterion cri = new NumericFieldCriterion(“Opp.MortRate”, 4,
OrdinalFieldMatchType.LessThan);

// Perform the query
ContactList contacts = session.Contacts.Query(cri, ContactLoanMatchType.None, ContactType.Borrower);

// For each of these contacts, delete the associate opportunity
foreach (BorrowerContact contact in contacts)
contact.Opportunities.Remove(contact.Opportunities[0]);

// End the session to gracefully disconnect from the server
session.End();
}
}

You may also like...

Popular Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.