Login / Register  search  syndication  about

          Ryan Farley's Blog

Ryan Farley on .NET Development with a focus on CRM Development for SalesLogix

Elegant SalesLogix Table ID Class in C#

I've been using the following C# class for creating SalesLogix table ID values lately and I just love the elegant syntax it provides. It's really been growing on me.

Here is the class:

using System;
using System.Data.OleDb;

namespace SalesLogix.Utility
    public class TableID
        private string _table = string.Empty;

        public TableID(string TableName)
            switch (TableName.ToUpper())
                case "ATTACHMENT": _table = "FILEATTACH"; break;
                case "USERNOTIFICATION": _table = "USERNOTIFY"; break;
                case "AGENTS": _table = "HOSTTASK"; break;
                case "RESOURCELIST": _table = "RESOURCE"; break;
                case "USEROPTION": _table = "USERVIEW"; break;
                case "JOINDATA": _table = "JOIN"; break;
                case "PROCEDURES": _table = "PROCEDURE"; break;
                case "SEC_FUNCTIONOWNER": _table = "FUNCTIONHANDLER"; break;
                default: _table = TableName; break;

        public override string ToString()
            return this.Value;

        public string Value
                using (OleDbConnection conn = new OleDbConnection(Globals.ConnectionString))
                    using (OleDbCommand cmd = new OleDbCommand(string.Format("slx_dbids('{0}', 1)", _table), conn))
                        return cmd.ExecuteScalar().ToString();

Nothing out of the ordinary there, but the really nice part comes from it's usage:

string ticketid = new TableID("ticket").Value;

I like it :-)

What's This?
Bookmark and Share

About Ryan Farley

   Ryan Farley is the Director of Development for Customer FX and creator of slxdeveloper.com. He's been blogging regularly about SalesLogix since 2001 and believes in sharing with the community. He loves C#, Javascript, Python, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

View the SalesLogix Mobile Seveloper Series
View the SalesLogix SData Developer Series
View the Git for the SalesLogix Developer series

Related Content
   Better Code Organization for Infor CRM (Saleslogix) Mobile Customizations
When customizing the Infor CRM (Saleslogix) Mobile client, it's common for the ApplicationModule to g
Posted on May 05, 2015 by Ryan Farley to Ryan Farley's Blog
   Index of Posts for Starting with Infor CRM (Saleslogix) Development
The blogs on customerfx.com go all the way back to 2003. There's years and years worth of information
Posted on Dec 30, 2014 by Ryan Farley to Ryan Farley's Blog
   Easily Showing and Hiding Tabs at Runtime in Infor CRM (Saleslogix)
Showing and hiding tabs in the Infor CRM (Saleslogix) client should be an easy thing. It should be someth
Posted on Dec 16, 2014 by Ryan Farley to Ryan Farley's Blog
   Avoiding the Dirty Data Message When Programatically Redirecting to a Record in Infor CRM (Saleslogix)
In my last post I wrote about using the OnClientClick property of a control (or button) to run JavaScript
Posted on Dec 02, 2014 by Ryan Farley to Ryan Farley's Blog
   Confirming Actions With an "Are you sure?" Prompt in Infor CRM (Saleslogix)
I'm not a huge fan of bugging end users. I figure, if an end user clicked something, he or she meant
Posted on Nov 18, 2014 by Ryan Farley to Ryan Farley's Blog


Mark Dykun said:


Like the method. I would add a second method to the class Values that can return an array of id's as well.


May 7, 2008 3:01 PM

Ryan Farley said:

I've not used this in an app yet that had a need for multiple ID values to be created at once, but that would be a great addition.

Signature would look like:

public List<string> Values(int Count)

Which would make for some nice syntax:

List<string> idlist = new TableID("ticket").Values(10);

Very nice.


May 7, 2008 3:13 PM

Jim Forte said:

Question. I am trying to build a contactID outside of windows in perl, using freeTDS. Any thoughts on how I can build it without the functions built into sales logix?

May 8, 2009 2:35 PM

Leave a Comment

All contents Copyright © 2015 Customer FX Corporation
Customer FX Corporation
2324 University Avenue West, Suite 115
Saint Paul, Minnesota 55114
Tel: 800.728.5783

  Follow @CustomerFX on twitter
Follow the best news, tips, and articles
  Subscribe to Customer FX on youtube
Watch SalesLogix tutorial videos from Customer FX
Login / Register