Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Saturday, June 28, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Add attachment to any form?
Remy
Posts: 42
 
Add attachment to any form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Jun 11 7:28 AM
fiogf49gjkf0d

Is there any (easy Smile) way to add an attachment to any given form? I attempted to examine the existing methods used for Account and Activities, but can't figure out how to re-use it properly. I don't need a datagrid for multiple attachments, just a simple field for one. Actually, even a link to a network shared folder would work. Obviously the user could just copy and paste the path to a link field, but is there a way to have a lookup open a Open File dialog window, then copy the path to a link field (in SLX web 7.5)?


Thanks!

[Reply][Quote]
RJ Samp
Posts: 973
Top 10 forum poster: 973 posts
 
Re: Add attachment to any form?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Jun 11 5:31 AM
fiogf49gjkf0d

Well the quick answer is no easy way....but the answer is yes as I just did this for a client.
You need to do an FSO copy from the selected by the user document file location to the SLXAttachmentPath area and then store an Attachment record.....I suppose you could store the AttachID into your table which would give you the 1 item reference link?
here's what I did.....note I'm only using !+12 character AttachID for the Filename in the SLX attachment doc directory. I used the Attachment Support included script for many/most/all of the routines and hints....


<pre>


' das Globals


Dim strFile, strFileName, strExt, strFileDate, intFileSize
Dim FSO, oFile   ' specific file information.


''' ***** File Selection lookup edit control:
Sub lueFilePopupReturn(Sender)


    lueUserID.Text                  = currentUserID

    ' FSO stuff....
    strFile                        = lueFile.Text
    Set FSO                     = CreateObject("Scripting.FileSystemObject")  'DNL
    strExt                         = FSO.GetExtensionName(strFile)
    strFileName                 = FSO.GetFileName(strFile)

    Set oFile                   = FSO.GetFile(strFile)
    intFileSize                 = oFile.Size
    strFileDate                 = oFile.DateLastModified
    set oFile    = Nothing

    Set FSO      = Nothing

    txtDocumentType.Text     = strExt

    ' set screen controls
    ' file size
    numFileSize.Text = intFileSize                            '' sets the databound field.
    lblFileSize.Caption = FormatFileSize( intFileSize )       '' sets the display caption.
    ' attachment description in english
    txtFileDesc.Text            =  StripExtensionFromFile( strFileName )
    ' who is attaching
    lblAttachedBy.Caption       = "Attached by:       " & currentUserName

    ' file date
    lblAttachModified.Caption   = strFileDate
    dteAttachDate.DateTime      = strFileDate

    ' file name
    txtFileName.Text            = trim("!" & currentAttachID & "." & strExt)
End Sub


' ******* on the OK button that stores the Attachment record automagically:
    gBlnHostDB      = (Trim(GetField("DBTYPE", "SYSTEMINFO", "SYSTEMINFOID = 'PRIMARY'")) = 1) 'DNL
    gStrAttachPath  = Application.BasicFunctions.GetAttachmentPath
    gStrSiteCode    = GetSiteCode()


    if isAddMode then   ' process the file
       strFile = lueFile.Text
       Set FSO = CreateObject("Scripting.FileSystemObject")  'DNL
       strfileName             = trim("!" & currentAttachID & "." & strExt)
        ' copy form Source to Target. Full path + file name is required.
        Application.Debug.WriteLine "Source: " & strFile & "   Target: " & gStrAttachPath & strfilename

        fso.CopyFile    strFile , gStrAttachPath & strfilename
        Set FSO      = Nothing
    else
        strFile = gStrAttachPath & txtFileName.Text
    end if

        If NOT(gBlnHostDB ) Then    '''remote attachment record
            Dim aCN
            Set aCN = NEW SLX_DB    'ADO Connection Object
            Dim SQL
            SQL ="INSERT INTO REMOTEATTACHMENTS (ATTACHID, STATUS, SITECODE) VALUES (" & _
                " '" & currentAttachID  & "', " & _
                " 'SEND', " & _
                " '" & gStrSiteCode  & "' ) "

            aCN.ExecuteSQL SQL
            SET aCN = Nothing
        End If


</pre>

[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 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): 6/28/2025 9:42:36 PM