Restrict LE and CD after CD issue

Here are codes in c# to restrict CD and LE after CD issuance

using EllieMae.Encompass.BusinessObjects.Loans;
using EllieMae.Encompass.BusinessObjects.Users;
using EllieMae.Encompass.Client;
using EllieMae.Encompass.Collections;
using System;

namespace MyBusinessRules
{
public class CdIssueDateRestriction
{
[BusinessRuleComponent(“Restrict LE and CD Changes after CD Issue Date is Entered”)] public static void RestrictCdAndLeChanges(Loan loan)
{
// Retrieve the CD Issue Date field value
string cdIssueDate = loan.Fields[“CD Issue Date”].FormattedValue;

// Check if the CD Issue Date field is not blank and the LE or CD forms are not in Draft status
if (!string.IsNullOrEmpty(cdIssueDate) && (loan.Forms[“Loan Estimate”].CurrentStatus != FormStatus.Draft || loan.Forms[“Closing Disclosure”].CurrentStatus != FormStatus.Draft))
{
// Retrieve the current user’s persona
string currentUserPersona = loan.Session.UserInfo.Persona.Name;

// Check if the current user is not an Admin or Closer
if (currentUserPersona != “Admin” && currentUserPersona != “Closer”)
{
// If the current user is not authorized, prevent changes to the LE and CD forms
loan.Forms[“Loan Estimate”].AllowEdit = false;
loan.Forms[“Closing Disclosure”].AllowEdit = false;

// Display a message to the user explaining the restriction
MessageBox.Show(“Only Admin and Closer personas are authorized to make changes to the Loan Estimate (LE) and Closing Disclosure (CD) forms after the CD Issue Date has been entered.”, “CD Issue Date Restriction”);
}
}
}
}
}

 

This code is structured as a C# class library and contains a single class named CdIssueDateRestriction, which contains a static method named RestrictCdAndLeChanges.

To use this code in Encompass, you would need to compile the class library project into a DLL file, and then add a reference to the DLL in the Encompass Business Rule configuration. Once the DLL is referenced, you can use the RestrictCdAndLeChanges method as the implementation for the business rule.

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.