How to Create the Finder using COMAPI in C#

By | July 29, 2019

In this blog, we are going to see how we can create the Sage 300 finder using the COMAPI in C# .Net.

This would be a useful to create a finder on custom projects.

Below are the steps which will guide through how we can create the Sage 300 finder.

New Stuff:  Create New Session using XAPI in C#

Step 1:

Include the Sage 300 COMAPI and Sage 300 Finder DLLs in the project.

Step 2:

Once the DLLs are included, create the object of the ViewFinder.

ViewFinder afinder = new ViewFinder();

Step 3:

Now we will assign a value to “Session”, “ViewID”, “InitKeyValue”, “InitKeyType”, “ReturnFieldIDs”, “DisplayFieldIDs” and “SearchFieldIDs” properties.

int[] DispArr = new int[5] { 1, 10, 4, 3, 24 };  // the array of field IDs that will be displayed in the finder’s columns.

int[] SearchArr = new int[5] { 1, 10, 4, 3, 24};  //the array of field IDs that will be used to search in the finder records.

afinder.Session = accpacDBLink.Session;

afinder.ViewID = “AP0015”;

afinder.InitKeyValue = “1200”;

afinder.InitKeyType = 1;

afinder.ReturnFieldIDs = 1;

afinder.DisplayFieldIDs = DispArr;

afinder.SearchFieldIDs = SearchArr;

Step 4:

Open the Finder


Step 5:

Now we call the ReturnFieldValues property to return the selected field.


So using this code we can create a Finder using COMAPI.

About Us:-

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

Greytrix offers unique GUMU™ integrated solutions of Sage 300 with Sage CRM, and Magento eCommerce along with Sage 300 Migration from Sage 50 US, Sage 50 CA, Sage PRO, QuickBooks, Sage Business Vision and Sage Business Works. We also offer best-in-class Sage 300 customization and development services and integration service for applications such as POS | WMS | Payroll | Shipping System | Business Intelligence | eCommerce for Sage 300 ERP and in Sage 300c development services we offer services such as upgrades of older codes and screens to new web screens, newer integrations using sdata and web services  to Sage business partners, end users and Sage PSG worldwide. Greytrix offers over 20+ Sage 300 productivity enhancing utilities that we can help you with such as GreyMatrix, Document Attachment, Document Numbering, Auto-Bank Reconciliation, Purchase Approval System, Three way PO matching, Bill of Lading and VAT for Middle East.

For more details on Sage 300 and 300c Services, please contact us at We will be glad to assist you.