Login / Register  search  syndication  about

          Ryan Farley's Blog

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

Creating a Pretty Key like the SalesLogix Ticket ID

A question that comes up every now and then is how to create a shorter, prettier key like the Ticket ID used in the support client. This is needed if programatically creating tickets, or if you need some unique number for some custom module such as a quote number. Using the SalesLogix table ID for something such as a quote ID results in a long hard to read value (and won't win you many points with your customer). Creating a SalesLogix “Pretty Key” is easy, but there are some things to know about using these keys.

To create a pretty key in version 6.1 or earlier, you can use a function such as this:

Function CreatePrettyKey(ByVal sJobID)
Dim lNum
Dim sTmpNum
Dim i
Dim iPwr
Dim lNumCmp

    sTmpNum = Right(sJobID, 5)
    For i = 1 To 5
        iPwr = 5 - i
        lNum = Asc(UCase(Mid(sTmpNum, i, 1)))
        If (lNum >= 48 And lNum <= 57) Then
            lNum = lNum - 48
        Else
            If (lNum >= 65 And lNum <= 90) Then
            lNum = lNum - 55
            End If
        End If
        lNum = lNum * 36 ^ iPwr
        lNumCmp = lNumCmp + lNum
    Next
    CreatePrettyKey = "1-" & LTrim(CStr(lNumCmp))
End Function

Add that into a VBScript plugin and then include when needed. You pass to it the table ID for the record you're creating it for. If you are creating a ticket you'd pass to it the table ID for your entry on the TICKET table. If you're using it for something else you'd pass it the ID for that table. It will produce a pretty key based on that table ID. If your table ID is ABO1W000A234 then it will produce a pretty key value of 1-469264. I should also add that the hard-coded key prefix “1-“ is the same way this is done in the support client (which is part of the problem discussed next).

In v6.2 things change a little. The problem with the current way in 6.1 and prior is that there is no way to ensure uniqueness between remotes. In 6.2, the pretty key's prefix (usually “1-”) is now unique per user in order to resolve this issue. In order to accomodate that change, new built-in functions were added to create the prefix and suffix parts of the key.

In SalesLogix 6.2 you use the following functions:

Application.BasicFunctions.GetPrettyKeyPrefix
Application.BasicFunctions.GetPrettyKeySuffix

You simply combine the KeyPrefix with the KeySuffix and you have your complete PrettyKey which will be unique across remotes.

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
   Infor CRM (formerly Saleslogix) Web- Dependency Lookup OnChange Event Not Working Correctly
In the Saleslogix 8.1 web client the dependency lookup still has a problem with the OnChange event. 
Posted on Nov 26, 2014 by Kris Halsrud to Kris Halsrud'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
 
   Infor CRM (formerly Saleslogix) Statement of Direction
Learn more about the future of Infor CRM. Recently I received my login information for the Infor Partn
Posted on Nov 13, 2014 by Brianna Ojard to The Inbox
 
   Xbar for InforCRM (formerly SalesLogix) Installation Issue
After installing Xbar 1.1 on a Windows 2008 R2 server the Xbar application was not available in Outlook 2
Posted on Nov 11, 2014 by Mark Duthoy to SalesLogix Support
 
   Programmatically Using Security Roles and Secured Actions in Infor CRM (Saleslogix)
In most places in the Infor CRM (Saleslogix) web client, it's pretty easy to use security roles. You
Posted on Nov 07, 2014 by Ryan Farley to Ryan Farley's Blog
 
Comments

 

Chris Donaldson said:

I am having a brain dead day....where do I find the tableID?

Thanks...cd

September 11, 2009 2:22 PM
 

Ryan Farley said:

Hi Chris,

You retrieve it from the table for the record you wish to create the PrettyKey for. Or if this is a new record you just create it normally using (assuming this is in a script) Application.BasicFunctions.GetIdFor("mytable")

September 11, 2009 3:16 PM
 

Ryan Farley's Blog said:

Some entities in SalesLogix, such as Tickets, use a &quot;pretty key&quot; as an easier to use value to reference the record. These pretty keys take a SalesLogix table ID value and then create a value like 000-00-1234. If you are creating an external

February 28, 2014 5:00 PM

Leave a Comment

(required)  
(optional)
(required)  
Add
All contents Copyright © 2014 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