How to bind Custom List in Dot net using Select SQL

By | July 21, 2016

As we know we can create list in Sage CRM which can be attached to a table or view. Using .net technology, we can filter the list with specific record with certain condition given to it. But, what if we need to bind the custom list with Select SQL statement. This blog article will help you to understand this.
New Stuff: Troubleshooting Apache Tomcat Service issue of Sage CRM
It’s possible for this follow the below steps.

  1. Create a List in Sage CRM.
  2. Below is the sample code snippet which can be used.

<Snippet>
string sSQL = “”;//Write your Select Sql Query.
//Create the list object.
List Test = new List(“List”);
Test.Clear(); //For Clear the List Column
//Create the list column object.
GridCol ColumnName1 = new GridCol(“ColumnName”);
GridCol ColumnName2 = new GridCol(“ColumnName”);
GridCol ColumnName3 = new GridCol(“ColumnName”);
//Add the column in list.
Test.Add(ColumnName1);
Test.Add(ColumnName2);
Test.Add(ColumnName3);
Test.SelectSql = sSQL;
Test.ToList();
//Add List on Page.
AddContent(Test);
</Snippet>
Note: – Use the Column name which is present in Select Query.
Also Read:
1. Create Custom screen in Sage CRM using PadBottom property
2. Apply underline to a Column Header in List or Grid
3. Adding Image Under Status Column on Grid
4. Control Column Visibility in Sage CRM Grids and Lists
5. Dot Net API Development Hints – Adding buttons to List page