We recently had a request to capture the changes made to a grid on an Opportunity Tab in SalesLogix. The three items requiring capture were:
- Any time a record was deleted
- Any time a record was added edited via an Add Edit Form
- Any time a check box in the grid was checked or unchecked
To implement this we simply created a function that would insert a record into the History table and would accept the OpportunityID, Description, Notes, and LongNotes as parameters.
Sub InsertHistoryRecord(strOpportunityID, strDescription,strNotes, strLongNotes)
.Open "SELECT * FROM HISTORY WHERE 1=2", objSLXDB.Connection
.Fields("HISTORYID") = strHistoryID
.Fields("ACTIVITYID") = strHistoryID
.Fields("TYPE") = "262156"
.Fields("NOTES") = strNotes
.Fields("LONGNOTES") = strLongNotes
.Fields("ATTACHMENT") = "F"
Then we inserted a call to this procedure on the grid's OnCheckColumnToggle, the function that deleted records, and the form that added or edited records. We wrote this custom procedure so that the history record creation would be seemless to the user and so we could control the data as we wanted.