SalesLogix URLs are very neat things, allowing you to jump to any ACO record in SLX even from applications outside of SalesLogix.
And the nice thing about the OTB code in the “System:SLX View Launcher” script which implements that, is that it will even handle your own custom entities/mainviews, without needing any modifications to the code.
But suppose you want to be able to open Attachments in the same way, e.g., by writing the “slx://attachment/attachmentid” URL into an Excel hyperlink, to open the Attachment directly from Excel?
It’s easy, and just requires a small change in that same script (with some rewriting of the existing code to make it clearer):
slashpos = instr(1, strTaskName, "/") strTableName = Mid(strTaskName, 1, slashpos-1) strID = Mid(strTaskName, slashpos+1, len(strTaskName)) If UCase(strTableName) = "ATTACHMENT" Then strFilename = Application.BasicFunctions.GetAttachmentPath _ & GetField("Filename", "Attachment", "AttachID = '" _ & strID & "'") strDescription = GetField("Description", "Attachment", _ "AttachID = '" & strID & "'") OpenSelectedFile strFilename, strDescription Else Application.BasicFunctions.ShowDetails strTableName, strID End If
To use the OpenSelectedFile functionality, you’ll need to Include the “System:Attachment Support” script (which itself Includes the “SLX Database Support” script, and thus the GetField procedure). The first GetField call is (obviously) retrieving the Filename from the Attachment table, for the AttachID in question.