Create a form in the input form builder to accept search text and based on input we can search field name in Encompass and display its details and how to create DLL to achieve same result in Visual Studio
- Open the Input Form Builder in Encompass and create a new form.
- Drag and drop a Text Field control onto the form to accept the search text from the user.
- Add a button control to the form that the user will click to initiate the search.
- Double-click on the button to open the Code Editor.
- Add the following code to the button’s click event:
string searchText = FieldUtils.GetFieldValue(“SearchTextField”);
string result = string.Empty;
foreach (var field in Fields.GetAllFields())
{
if (field.Name.Contains(searchText))
{
result += $”Field ID: {field.ID}, Field Name: {field.Name}, Field Value: {field.Value}\n”;
}
}
FieldUtils.SetFieldValue(“ResultTextField”, result);
This code retrieves the search text entered by the user, loops through all the fields in Encompass, and searches for field names that contain the search text. When a matching field is found, its details are added to a result string. Finally, the result string is set as the value of a text field named “ResultTextField” on the form.
- Save and close the Code Editor.
- Run the form and test the search functionality by entering a search term and clicking the search button.
By following these steps, you should be able to create a form in Input Form Builder that accepts search text and displays the details of matching fields in Encompass. Note that you may need to modify the code to suit your specific use case, such as filtering the fields based on certain criteria or displaying the results in a different format.
Now to create DLL for above functionality, here are the codes to achieve this in Visual Studio
- Open Visual Studio and create a new Class Library project.
- Add a reference to the Encompass SDK by right-clicking on the project in the Solution Explorer and selecting “Add Reference”. In the Reference Manager, select “Browse” and navigate to the Encompass SDK DLL file. Click “Add” to add the reference to the project.
- Add a new class to the project and name it something like “EncompassSearch”.
- In the class, add the following code:
using EllieMae.Encompass.Client;
namespace EncompassSearch
{
public static class EncompassSearchUtility
{
public static string SearchFields(string searchText)
{
string result = string.Empty;
using (Session session = new Session())
{
session.Start(“EncompassSearch”);
Fields fields = session.Loans.FieldLock.Fields;
foreach (var field in fields.GetAllFields())
{
if (field.Name.Contains(searchText))
{
result += $”Field ID: {field.ID}, Field Name: {field.Name}, Field Value: {field.Value}\n”;
}
}
}
return result;
}
}
}
This code is similar to the code used in the Input Form Builder form, but it uses the Encompass SDK to connect to the Encompass loan and retrieve the field information. The function takes a search text parameter and returns a string containing the details of matching fields.
- Build the project to create the DLL. By default, the DLL will be located in the “bin\Debug” or “bin\Release” folder of your project directory.
You can now use the EncompassSearch DLL in other C# projects or applications to perform field searches in Encompass. To use the DLL, you will need to add a reference to it in your project and call the SearchFields
function with the appropriate search text parameter.
- Create a new Console Application project in the solution by right-clicking on the solution in the Solution Explorer and selecting “Add” > “New Project”. Choose the “Console Application” project template and give the project a name, such as “EncompassSearchConsoleApp”.
- Add a reference to the EncompassSearch project by right-clicking on the Console Application project in the Solution Explorer and selecting “Add Reference”. In the Reference Manager, select the EncompassSearch project from the “Projects” tab.
- In the Console Application project, add the following code to the
Main
method:
using System;
namespace EncompassSearchConsoleApp
{
class Program
{
static void Main(string[] args)
{
Console.Write(“Enter search text: “);
string searchText = Console.ReadLine();
string result = EncompassSearch.EncompassSearchUtility.SearchFields(searchText);
Console.WriteLine(result);
Console.ReadKey();
}
}
}
This code prompts the user to enter a search text and calls the SearchFields
function from the EncompassSearch DLL to perform the field search. The results are displayed in the console.
- Build the Console Application project and run it to test the field search functionality.
By following these steps, you should be able to create a Visual Studio solution that includes a DLL with Encompass field search functionality and a Console Application project that uses the DLL to perform searches. You can modify the code to suit your specific needs or integrate the DLL into other applications as needed.