Easiest way to filter Custom list By Context Id in Entity’s List Page

By | December 27, 2021

Sage CRM has its own .NET API (Application Programming Interface) that allows a developer to extend Sage CRM functionality by creating and using .NET DLLs (Dynamic Link Libraries). Developers can add references of DLLs from and within Sage CRM and thus call methods exposed by the DLLs to perform certain actions. The Sage CRM .NET API is an alternate way of using traditional classic ASP-based customizations in Sage CRM. The .NET API provides a type of library that exposes Sage CRM objects, properties, and methods. Through the core libraries exposed by the .NET API, you can manage data access and Web Interface generation.

Sage CRM provides an SDK of Entity template to create a set of classes to support a custom entity. This entity template allows a developer to create a .NET DLL that provides a customized graphical user interface for Sage CRM custom entities. Creating a new .NET DLL from the entity template doesn’t create a new entity table, screens, and List blocks in Sage CRM. The developer must need to do this first in the Sage CRM front end or through the Advanced Customization Wizard. When the developer uses the entity template to create a new C# project in Microsoft Visual Studio, the CRM .NET Entity Wizard help to generate the custom pages.

Entity wizard helps you to create Sage CRM Pages that can be used to create, edit, delete, view details of a particular entity instance. After creating an entity template it creates the EntityDataPage, Edit, Delete, New, List and Search pages. These pages help developers to get a basic idea of designing and organizing standard functionalities in .Net API. Also, these pages help to define the screen that allows a user to create, view, and modify entity records in Sage CRM.

Related Post : Adding a Pipeline graphic to List using .Net API in Sage CRM

In this blog, we will explain how we can filter list screen with current context Id. Sage CRM SDK provides various options to get context id in .NET DLL.

As per the steps, when the user uses the entity template to create a new C# project in Microsoft Visual Studio, the CRM .NET Entity Wizard starts. In this wizard, it is required to fill complete information of the following options and then click on “GO” button.

  • New Entity Name: In this option, the user needs to enter the name of the custom entity.
  • Id field: In this option, the user needs to enter the ID field name of the custom entity table, which was mentioned at the time of creating a new custom entity in Sage CRM.
  • Prefix: Enter the prefix to be used for the fields in the new custom entity table, which was mentioned at the time of creating the new custom entity table in Sage CRM.

On finishing the above steps, the entity template creates various .cs files. We need to open “EntityListPage.cs” file. This page creates an instance of a specialized web class ListPage. On this page, we need to add FilterByField and FilterByContextId to allow the list to be filtered dynamically within the current context ID.

Below is the sample code snippet used in the Entity List Page –

<Snippet>
public PeopleList()
: base(“Person”, “PersonList”, “PersonFilterBox”)
{
FilterByField = “pers_companyid”;
FilterByContextId = (int)Sage.KeyList.CompanyId;
}
</Snippet>

After adding the above code you need to build dll and add it to your Sage CRM “CustomDotNet” folder.

Now, login into the CRM, it will navigate to the custom list screen of the application and you can see that list will be filtered based on the current context.

In this way, by writing a few lines of C# code in the “EntityListPage.cs” file, you can modify the filter option based on the current context.

About Us

Greytrix – a globally recognized and one of the oldest Sage Development Partners is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience and expertise, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development, and implementation competence.

Greytrix has some unique integration solutions developed for Sage CRM with Sage ERPs namely Sage X3Sage IntacctSage 100Sage 500, and Sage 300. We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users, and Sage PSG worldwide. Greytrix helps in the migration of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes addons like  Greytrix Business ManagerSage CRM Project ManagerSage CRM Resource PlannerSage CRM Contract ManagerSage CRM Event ManagerSage CRM Budget PlannerGmail IntegrationSage CRM Mobile Service SignatureSage CRM CTI Framework.

Greytrix is a recognized Sage Champion Partner for GUMU™ Sage X3 – Sage CRM integration listed on Sage Marketplace and Sage CRM – Sage Intacct integration listed on Sage Intacct Marketplace. The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for the processing and execution of application programs at the click of a button.

For more information on our integration solutions, please contact us at sage@greytrix.com. We will be glad to assist you.