Follow-up to Changes to the Notes History Common script in SalesLogix 7.5.1

In an earlier post I talked about how SalesLogix introduced a fix to the Notes History Common script in the SalesLogix LAN client to handle how HISTORYIDs are stored in the ATTACHMENT table.  I discovered today that another related area in the same script, as well as in another screen remains unfixed.


In the Notes History Common script, when you choose to view Attachments on the History screen’s context menu it will check to see if there are more than one attachments defined for the history record.  If there are, it will launch a screen to allow the user to select the attachment to open.  This functionality is handled in the “InvokeHistoryAttachmentView” routine.  The code looks like the following:



Sub InvokeHistoryAttachmentsView
    Dim objMainView, objDetail


    Set objMainView = Application.MainViews.Add(“System:View History Attachments”, 0, True)  ‘DNL
    objMainView.BorderStyle = 3
    Set objDetail = objMainView.DetailsView
    objDetail.Caption = Application.Translator.Localize(“View Attachments”)
    objDetail.grdAttach.BindID = grdHistory.GetCurrentField(“HISTORYID”) ‘DNL
    objMainView.ShowModal
    Set objDetail = Nothing
    Set objMainView = Nothing
End Sub


The problem is that they are attempting to bind the grid to only the HISTORYID field of the Attachment table, when we know based on my last post that this is not always where the HISTORYID is stored.  Instead this code needs to be changed to:



Sub InvokeHistoryAttachmentsView


    Dim objMainView, objDetail
    Set objMainView = Application.MainViews.Add(“System:View History Attachments”, 0, True)  ‘DNL
    objMainView.BorderStyle = 3
    Set objDetail = objMainView.DetailsView
    objDetail.Caption = Application.Translator.Localize(“View Attachments”)
    objdetail.grdattach.sql.text=”SELECT A1.ATTACHID, A1.DESCRIPTION, A1.FILENAME FROM ATTACHMENT A1 WHERE A1.HISTORYID = ‘” & grdHistory.GetCurrentField(“HISTORYID”) & “‘ or A1.ACTIVITYID='” & grdHistory.GetCurrentField(“HISTORYID”) & “‘”
    objdetail.grdattach.refresh
    objMainView.ShowModal
    Set objDetail = Nothing
    Set objMainView = Nothing


End Sub


 


This will correctly allow the attachments for history records to show.


One additional thing


With the changes listed above, you will correctly be able to see the dialog appear and list the attachments for the current History.  However if you try to open one of the attachments from this dialog you will receive an error, something in reference to invalid parameter for OpenSelectedFile.


This is because the  dialog screen that opens has another bug currently.  If you open this form (System:View History Attachments) you will see in its code space that there is only one routing called “cmdOKClick”.  This is the event that attempts to open the attachment specified by either clicking the button or double clicking the grid. The code looks like:



Sub cmdOKClick(Sender)
    OpenSelectedFile Application.BasicFunctions.GetAttachmentPath & grdAttach.GetCurrentField(“FILENAME”), _
                     grdAttach.GetCurrentField(“ATTACHID”), _
                     grdAttach.GetCurrentField(“DESCRIPTION”) ‘DNL
End Sub


Now if you look into the include file of this form, you will see the OpenSelectedFile routine only accepts two parameters, not three as it is currently.  To fix the error, you can change the code to the following:



Sub cmdOKClick(Sender)
    OpenSelectedFile Application.BasicFunctions.GetAttachmentPath & grdAttach.GetCurrentField(“FILENAME”), grdAttach.GetCurrentField(“DESCRIPTION”) ‘DNL
End Sub


These changes should fix everything.  Hopefully Sage will address these in SalesLogix 7.5.2.  Better yet, they will change the incorrect behavior of storing the HISTORYID of ATTACHMENT records.  For now, following these chnages will give you the functionality that is missing.

ABOUT THE AUTHOR

Kris Halsrud

Kris Halsrud is a Senior Analyst / Developer for Customer FX Corporation.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Join our mailing list to receive the latest Infor CRM (Saleslogix) and Creatio (bpm'online) news and product updates!

You have Successfully Subscribed!