Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, March 29, 2024 
 
The SalesLogix URL Link  
Description:  Something lacking in SalesLogix is the ability to send a link to other SalesLogix user in reference to a particular record in SalesLogix. Say you want to send an e-mail to another SalesLogix user regading XYZ Corp. Wouldn't it be nice to be able to send him a link in the e-mail to allow him to jump right to the record in question? The SalesLogix URL Link solves this problem and provides a way to create hyperlinks to accounts, contacts, opportunities, tickets, and anything that is represented as a SalesLogix MainView. We'll create a custom URI handler and use SalesLogix automation to move to the appropriate record.

Category:  SalesLogix COM
Author:  Ryan Farley
Submitted:  3/10/2006
   
Stats: 
Article has been read 39150 times

Rating: - 5.0 out of 5 by 11 users
 

fiogf49gjkf0d
The SalesLogix URL Link

Something lacking in SalesLogix is the ability to send a link to other SalesLogix user in reference to a particular record in SalesLogix. Say you want to send an e-mail to another SalesLogix user regading XYZ Corp. Wouldn't it be nice to be able to send him a link in the e-mail to allow him to jump right to the record in question? The SalesLogix URL Link solves this problem and provides a way to create hyperlinks to accounts, contacts, opportunities, tickets, and anything that is represented as a SalesLogix MainView. We'll create a custom URI handler and use SalesLogix automation to move to the appropriate record.

Before we get too far into this, I do want to point out. The URL Link will be a built in part of SalesLogix version 7. I've modeled the code here to match how the built in URL Link will work so things will transition smoothly to version 7.


Registering a Hyperlink Handler

In order to create a hyperlink we'll need to create a URI handler. Similar to a website URL that begins with HTTP, we need to have our own prefix to handle our hyperlinks. We'll use 'slx' as our handler. What we want to end up with is a link that describes the table that the record is contained in and the primary key of the record itself. This will work with MainViews. We'll want to make happen is to move to the MainView for the table and go to the record for the primary key value.

We'll want the URL to look like this:

slx://tablename/primarykey


Example:

slx://account/AXXXX0000001

Setting up the URI handler is easy enough. Just a simple addition to the system's registry. When we add the entries to the registry we'll need to indicate the application name and path that we can pass the table name and primary key values to on the command line. This application could be a simple VBScript file, or a full executable. We'll be using an executable to avoid any problems with virus scanners.

Our registry entries will be as follows (these can be pasted into a text file and given an 'reg' extension for easy adding to the registry.)

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\slx]
@="SalesLogix Protocol Handler"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\slx\DefaultIcon]
@="C:\\Program Files\\SalesLogix\\salesLogix.exe"

[HKEY_CLASSES_ROOT\slx\shell]

[HKEY_CLASSES_ROOT\slx\shell\open]

[HKEY_CLASSES_ROOT\slx\shell\open\command]
@="\"C:\\Program Files\\SalesLogix\\SalesLogixUrlLink.exe\" %1"

Once we add this into the registry the URI handler is complete. Now all we need to do is build the SalesLogixUrlLink.exe and place it in the path we specified in the registry.


Moving to a SalesLogix MainView Record

When a 'slx' hyperlink is clicked, the 'open' command associated with the handler (our executable) is invoked. The entire URL is passed on the command line to the application. So, for the example listed above of slx://account/AXXXX0000001, the entire URL of slx://account/AXXXX0000001 will be passed on the command line to our application. What we first need to do is parse out the table name and ID value. Once we get the table name and ID value we can instanciate an automation object to communicate with SalesLogix and then call ShowDetails. ShowDetails is a generic method which will allow us to generically load the appropriate MainView for the table and also specify the ID for the record we wish to display. For the C# code below, don't forget to add a COM reference to the 'SalesLogix Library' found in SalesLogix.exe.

using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;

// Add COM reference to 'SalesLogix Library' found in SalesLogix.exe

namespace SlxDeveloper.SalesLogixUrlLink
{
    public class LinkHandler
    {
        [DllImport("user32.dll", CharSet=CharSet.Auto)]
        public static extern IntPtr FindWindow(string ClassName, string WindowText);

        static void Main(string[] param) 
        {
            // quit if for whatever reason we didn't get params
            if (param.Length == 0) return;

            // if SalesLogix is not running we don't want to continue
            if (FindWindow(null, "SalesLogix") == IntPtr.Zero)
            {
                MessageBox.Show("SalesLogix is not running.", "SalesLogix Link");
                return;
            }

            // get table name and id value 
            MatchCollection col = new Regex(@"\w+").Matches(param[0]);
            string table = col[1].Value;
            string id = col[2].Value;

            // now we need to load SalesLogix and move to the 
            // mainview for the values passed
            SalesLogix.SlxApplication slx = null;
            try
            {
                slx = new SalesLogix.SlxApplicationClass();

                // call ShowDetails to generically load the mainview 
                // for the table name passed to us and move to the 
                // specified id value
                slx.BasicFunctions.ShowDetails(table, id);
            }
            catch (COMException) { /* eat exception, SalesLogix likely not installed */ }
            finally
            {
                if (slx != null) Marshal.ReleaseComObject(slx);
            }
        }
    }
}

Now we can compile that code as 'SalesLogixUrlLink.exe' and copy it to the SalesLogix directory (since that is what we specified in the registry entries above).


Using the SalesLogix URL Link

Now that we have the code complete we can use the SalesLogix URL Link in any number of locations. We could add hyperlinks to SalesLogix records (which are represented by a MainView in SalesLogix) in intranet webpages, e-mails sent regarding customers, opportunities, or tickets in SalesLogix, even in messenger conversations, and many other types of locations.

All we need to do is form the URL. We could easily put a button on the toolbar captioned 'Get Record Hyperlink' with a script that does the following:

Sub Main
Dim shell
Dim mv
Dim link
Dim recname

    Set mv = Application.MainViews.ActiveView
    link = "slx://" & mv.BaseTable & "/" & mv.CurrentID

    recname = Replace(mv.Caption, " ", "%20")

    Set shell = CreateObject("WScript.Shell")
    shell.Run "mailto:?subject=" & recname & "&body=" & recname & "%0A" & link, 1, false
    Set shell = Nothing
End Sub

This would allow the user to copy the current record (whether it be an account, contact, opportunity, ticket, or other custom MainView record) as an e-mail containing a hyperlink to the record. The result produced here would have something such as "Account: Abbott Ltd." in the subject line and the body of the mail window would be like the following:

Account: Abbott Ltd. 
slx://ACCOUNT/AGHEA0002669

Another very useful scenario would be to use the hyperlink is notifications sent by KnowledgeSync to provide a quick and easy way for users to jump to records mentioned in the notifications sent regarding SalesLogix records.


Wrapping it up

I am glad to see that the SalesLogix URL Link will be making it into the product for version 7. This is an invaluable and time-saving way to assist the user to jump to records and send links to records to other users.

Until next time, happy coding!
-Ryan


Updates

  • 3/13/2006 - I just wanted to note (thanks RJLedger) that the current BETA of version 7 uses a format of slx:tablename/primarykey for the links (note no '//' after the colon). However, IMO that is a bug and should be fixed before it's release. Should you wish to use that format now, the code in this article will continue to work with that format thanks to the regular expression (it doesn't really care what it starts with. It will work with slx: as well as slx:// - either way will work for this code. I'll update the article again when I hear back if they've fixed that problem in v7.

 

About the Author

  Ryan Farley
(SalesLogix Business Partner)
Customer FX Corporation

fiogf49gjkf0d

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 Ryan's SalesLogix Mobile Seveloper Series
View Ryan's SalesLogix SData Developer Series
View Ryan's Git for the SalesLogix Developer series



View online profile for Ryan Farley
 

[ back to top] [ send to a friend]  

Rate This Article you must log-in to rate articles. [login here] 
 
Please log in to rate article.
 

Related Articles 
 - The SalesLogix URL Link & Source Code - Submitted by: Ryan Farley

 

Comments & Discussion you must log-in to add comments. [login here] 
 
Author Article Comments and Discussion
Rob Seiwert



Re: The SalesLogix URL Link
Posted: 3/11/2006 2:53:56 PM
fiogf49gjkf0d
You've done it again. Very clean and functionality I've wished I've had since I started with SalesLogix back in '90.
 
Ryan Farley

slxdeveloper.com Site Administrator
slxdeveloper.com Forum Top 10 Poster!

Re: The SalesLogix URL Link
Posted: 3/13/2006 4:28:37 PM
fiogf49gjkf0d
Thanks Rob. I know. I first built a "URL Link" sort of thing for SalesLogix about a year and a half ago. After I built it I was amazed that it wasn't just a built in part of SLX because it made so much sense. After some talk about it at a SLX meeting with some other BPs (and with it coming in v7 as a built in part), I figured it was time to write it up for the site.

-Ryan
 
Sam Cayze
 

Re: The SalesLogix URL Link
Posted: 3/20/2006 10:32:40 AM
fiogf49gjkf0d
Ryan - another sweet how-to, thanks!

However, could someone please give me some help on how to create the toolbar captioned 'Get Record Hyperlink'?

I have everything else in place, I just cannot figure out how to make a toolbar with scripting behind it.

Thanks. Sam
 
Ryan Farley

slxdeveloper.com Site Administrator
slxdeveloper.com Forum Top 10 Poster!

Re: The SalesLogix URL Link
Posted: 3/20/2006 11:54:59 AM
fiogf49gjkf0d
Sam, an excellent question for the forums!

Meanwhile, I'll update the zip to include a sample bundle with the toolbar button (but still worth posting the question to the forums since you might get an answer before I'm able to update it!)
 
Ryan Farley

slxdeveloper.com Site Administrator
slxdeveloper.com Forum Top 10 Poster!

Re: The SalesLogix URL Link
Posted: 3/20/2006 6:27:07 PM
fiogf49gjkf0d
I've updated the bundle to contain a sample bundle with a toolbar. Enjoy.
 
Sam Cayze
 

Re: The SalesLogix URL Link
Posted: 3/21/2006 10:29:47 AM
fiogf49gjkf0d
Thanks Ryan - I have installed the bundle, and have the toolbar. However, it appears as text in Outlook, not a hyperlink. Ideas?
 
Ryan Farley

slxdeveloper.com Site Administrator
slxdeveloper.com Forum Top 10 Poster!

Re: The SalesLogix URL Link
Posted: 3/21/2006 10:59:08 AM
fiogf49gjkf0d
Hi Sam,

The bundle provided was intended to be just a quick sample to demonstrate how to build the URL/link from the current record in SalesLogix. If this was to be used for production, I would opt to not just shell a mailto link, but instead I would create an actual Outlook MailItem so you could format the body of the e-mail as HTML and have the URL appear as a hyperlink. I would have the hyperlink show the record name, not the URL, so the end result would be like:

Record Name

Know what I mean? Do a quick google search for "Outlook MailItem" and you're bound to find some good examples for creating HTML e-mail's for Outlook.
 
Jeremy Brayton
 
slxdeveloper.com Forum Top 10 Poster!

Re: The SalesLogix URL Link
Posted: 3/23/2006 4:14:47 PM
fiogf49gjkf0d
Application.BasicFunctions.QueMessage. It's a good place to start and honestly you're only wanting to fill in the body as any touching of the recipients raises the Outlook security prompt if done outside of this function. SalesLogix actually has a good example on how to manipulate the Outlook COM object if you need something a little more robust. It's named SLX_DoOutlook_AS and apparently hasn't changed since v6. The cool part about this code is it strips the signature and repurposes the body with the signature at the bottom, something mailto: doesn't do I believe.
 
Felipe Ho
 

Re: The SalesLogix URL Link
Posted: 10/22/2007 11:57:09 AM
fiogf49gjkf0d
Hi Ryan,

Does this code work for Saleslogix 6.2 Web Client?

Thanks,

Felipe.
 
Ryan Farley

slxdeveloper.com Site Administrator
slxdeveloper.com Forum Top 10 Poster!

Re: The SalesLogix URL Link
Posted: 10/22/2007 11:59:43 AM
fiogf49gjkf0d
Felipe,

No, this is for LAN client only.

-Ryan
 
Felipe Ho
 

Re: The SalesLogix URL Link
Posted: 10/22/2007 6:30:31 PM
fiogf49gjkf0d
Thanks Ryan,

Do you know how can I achieve the same functionality for the Saleslogix Web Client?

Felipe.
 
Mel Nepomuceno



Re: The SalesLogix URL Link
Posted: 1/21/2009 3:41:58 PM
fiogf49gjkf0d
Hi. Im very new to SLX and our company has just upgraded from v6.2.3 to v7.5. You mentioned that this SLX URL Link is built into v7. Please are you able to show or direct me where to access it in v7.5? Many thanks
 
Ryan Farley

slxdeveloper.com Site Administrator
slxdeveloper.com Forum Top 10 Poster!

Re: The SalesLogix URL Link
Posted: 1/21/2009 5:06:18 PM
fiogf49gjkf0d
Mel,

It exists in SLX 7.5, there's no where to "see" it, it's just built in. You can test it by opening SLX and going to start|run and entering something like "slx:ACCOUNT/AGHEA0002669" (without the quotes, change that last part, the ID to be a valid accountid in your system).

-Ryan
 
Mel Nepomuceno



Re: The SalesLogix URL Link
Posted: 1/21/2009 5:41:22 PM
fiogf49gjkf0d
Hi Ryan

It's there alright. Tried it with Account, Contact and Lead and they all worked fine. However for Ticket I always get an Invalid Record result. All I did was to copy paste the Ticket ID onto the command. Is there any particular reason it doesnt work same way in Tickets?

Thanks
Mel
 
Paul Bowen
 

Re: The SalesLogix URL Link
Posted: 1/22/2009 8:05:01 AM
fiogf49gjkf0d
Hello

We are running SLX 6.2 and I have installed the plugin and it works a treat. but I have installed the bundle for the toolbar button but I am not seeing the button. I installe it from the admin tool. Am I doing something wrong? Where should I see the button?
 
Rini
 

Re: The SalesLogix URL Link
Posted: 1/12/2010 8:52:29 AM
fiogf49gjkf0d
Hello Ryan,
I am new to SLX development. We are using SLX version 7.5. I need to generate an email (in outlook )from SLX with a link to SLX. So i tried the above code and its creating a line of text inside an email , which takes me to SLX if run the line from command prompt or from a browser. How can i display it as a URL (hyperlink text) in outlook itself

Thanks in advance
 
Ryan Farley

slxdeveloper.com Site Administrator
slxdeveloper.com Forum Top 10 Poster!

Re: The SalesLogix URL Link
Posted: 1/12/2010 10:21:36 AM
fiogf49gjkf0d
rxp6745,

You'll need to format the e-mail as HTML so you can add the link as a hyperlink using standard HTML anchor tags.

-Ryan
 
Rini
 

Re: The SalesLogix URL Link
Posted: 1/12/2010 12:57:38 PM
fiogf49gjkf0d
Thanks that worked !!...
 
 

       Visit the slxdeveloper.com Community Forums!
Not finding the information you need here? Try the forums! Get help from others in the community, share your expertise, get what you need from the slxdeveloper.com community. Go to the forums...
 



 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 3/29/2024 3:16:20 AM