Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, July 8, 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!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Adding history records "behind the scenes"
Tony
Posts: 28
 
Adding history records "behind the scenes"Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 22 Feb 10 5:23 PM
We have a number of backoffice processes that, in order to make them more effective, should record history in slx when the process occurs. For example, sending automated surveys to our clients, or performing software activations.

We would like to record these actions in SLX history, but these processes occur where no SLX is running, and often, where no direct human interaction is taking place.

What is the best way to create history records? Essentially we want do do the identical thing that "Add Note" does in the Notes/History tab, and we would populate the fields automatically, setting the account, contact, regarding, note text, etc, automatically.

My preference would be to use existing SLX stored procedures, (as opposed to using SLX objects). Any guidance would be appreciated.

I have the very excellent DevLogix III.7 book, but it didn't seem to have a lot of guidance on this in particular.

Thank you!

Tony
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Adding history records "behind the scenes"Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Feb 10 6:35 AM
Tony

That's exactly what you do - link via the Provider (or SQL direct if you have no remote) and simply add a new row into History table. If you run SLXProfiler - add a note - you will see exactly what you need to do e.g.

Here's something to get you started:

Sub RecordToHistory (sAccID, sConID, sCat, sDesc, sType, sNote)
Dim objSLXDB, objRS, strSQL
Set objSLXDB = New SLX_DB

Set objRS = objSLXDB.GetNewRecordSet
strSQL = "SELECT * FROM HISTORY WHERE 1=0"

objRS.Open strSQL, objSLXDB.Connection
objRS.AddNew

With objRS
.Fields("HISTORYID").Value = Application.BasicFunctions.GetIDFor ("HISTORY")
.Fields("TYPE").Value = cstr(sType)
.Fields("ACCOUNTID").Value = sAccID
.Fields("ACCOUNTNAME").Value = CheckForNull(Application.BasicFunctions.CurrentAccountName)
.Fields("CONTACTID").Value = sConID
.Fields("PRIORITY").Value = "None"
.Fields("CATEGORY").Value = CheckForNull(sCat)
.Fields("DESCRIPTION").Value = CheckForNull(sDesc)
.Fields("STARTDATE").Value = cstr(Now)
.Fields("COMPLETEDDATE").Value = cstr(Now)
.Fields("ORIGINALDATE").Value = cstr(Now)
.Fields("USERID").Value = Application.BasicFunctions.CurrentUserID
.Fields("USERNAME").Value = Application.Users.Item(Application.BasicFunctions.CurrentUserID).Name
.Fields("DURATION").Value = cstr(0)
.Fields("TIMELESS").Value = "F"
.Fields("RESULT").Value = "Complete"
.Fields("COMPLETEDUSER").Value = Application.BasicFunctions.CurrentUserID
.Fields("ATTACHMENT").Value = "F"
.Fields("NOTES").Value = CheckForNull(Left(sNote, 254))
.Fields("LONGNOTES").Value = CheckForNull(sNote)
.Update
If ErrorCheck (Application.Translator.Localize("Error updating [History]...")) > 0 Then exit sub
.Close
End With
Set objRS = Nothing

End Sub
[Reply][Quote]
Tony
Posts: 28
 
Re: Adding history records "behind the scenes"Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Feb 10 7:13 PM
Mike - thank you for this detailed response.

if i wanted to drive this from our back-end web engine and not vbscript in SLX, would it be appropriate to call the stored procs/insert statement directly? (I'm fine using profiler to figure out the code). I just don't have any access to actual SLX objects on the server where this code needs to run - so no "Application.BasicFunctions" method exists.

Thanks,

Tony
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Adding history records "behind the scenes"Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Feb 10 3:17 AM
Yes, this is fine also - for the AB.Functions - you will simply have to use hard-coded values (for the relevant users etc). Adding the primary ID is difficult but easily overcome - simply set the History table to auto-increment the primary id. Provided you still use the slx provider you can omit the HistoryID and slx will do this for you. In other words a simple INSERT XXX VALUES (X,X,X) would work just fine from any external app.
[Reply][Quote]
Tony
Posts: 28
 
Re: Adding history records "behind the scenes"Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Feb 10 11:51 AM
Got it. Now, I'm assuming you do NOT recommend that I go directly to the db provider (SQL server) but that i do it through the SLX provider, correct?

I just saw the flag to autoincrement the ID - and doing that won't affect my clients? cause my remote users to melt down? contribute to intestinal discomfort?

tony
[Reply][Quote]
Mike Spragg
Posts: 1226
Top 10 forum poster: 1226 posts
 
Re: Adding history records "behind the scenes"Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 24 Feb 10 1:21 PM
It depends - if you have remotes then definitely not. If you have no remotes in the system then you can do a direct update without any issues. If you do it direct, with remotes, they'll never get those notes (which, is sometimes an advantage). Adding the flag won't cause a meltdown!
[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): 7/8/2025 12:27:36 PM