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!
|
|
Create a note via scripting
Posted: 24 May 07 9:24 AM
|
fiogf49gjkf0d I know how to get the "Create Note" dialog to pop up on the screen so users can fill in information and save a note on the "Notes/History" tab. Is there a way I can create code to save a note here without using the dialog? (v6.2.6) |
|
|
|
Re: Create a note via scripting
Posted: 24 May 07 10:02 AM
|
fiogf49gjkf0d There may be a better way than this. But I just create a recordset based on "select * from History where 1=2" then write values to fields I want to fill in. very roughely (from memory)
set objslxDB = new SLX_DB
set objRS = objSLXDB.getnewrecordset
strsql = "select * from History where 1=2"
objRS.open strsql, objSLXDB
objRS.addnew
objRS.fields("HistoryID").value = getidfor("History") objRS.fields("TYPE").value = 262154 (or whatever this note type is) . . .
objRS.update
objRS.close
Hope this helps
Nick |
|
|
|
Re: Create a note via scripting
Posted: 24 May 07 10:52 AM
|
fiogf49gjkf0d Thanks, Nick. I was able to save the information in the table, but the record does not show on the Notes/History tab. Does anyone have any ideas why? |
|
|
|
Re: Create a note via scripting
Posted: 24 May 07 10:59 AM
|
fiogf49gjkf0d I've never had problems with it not showing up before, which suggests that there is no funny inner joins to watch or anything like that.
That said Important fields to fill in would be (I'm guessing here) Completeddate, type, historyid, contactid, accountid, userid
The record you have saved to the db does have accountid/contactid/oppid filled in?
Nick |
|
|
|
Re: Create a note via scripting
Posted: 24 May 07 1:10 PM
|
Yes, those fields are filled in, but I still don't have the record showing on the Notes/History tab.  |
|
|
|
Re: Create a note via scripting
Posted: 24 May 07 1:14 PM
|
fiogf49gjkf0d Not even after a full refresh? If you look at the table using query analyzer do you see your record there? |
|
|
|
Re: Create a note via scripting
Posted: 24 May 07 1:21 PM
|
fiogf49gjkf0d Yep...even after a full refresh. The record does show via Query Analyzer and via SQL in the SalesLogix Administrator.
I created my note through code and a test note through normal means. I compared the two records in the table and noticed that some fields were null and others were empty. I adjusted my code to match the fields from the test note. Below you will see the lines that I have commented out in order to generate null values.
*****
set objslxDB = new SLX_DB
set objRS = objSLXDB.getnewrecordset
strsql = "select * from History where 1=2"
objRS.open strsql, objSLXDB.Connection
objRS.addnew
objRS.fields("HISTORYID").value = HistID objRS.fields("ACTIVITYID").value = ActvID objRS.fields("TYPE").value = HistType objRS.fields("ACCOUNTID").value = AcctID objRS.fields("CONTACTID").value = ContID objRS.fields("OPPORTUNITYID").value = "" objRS.fields("ACCOUNTNAME").value = AcctName objRS.fields("CONTACTNAME").value = ContactName objRS.fields("OPPORTUNITYNAME").value = "" objRS.fields("PRIORITY").value = "" objRS.fields("CATEGORY").value = "" objRS.fields("STARTDATE").Value = StartDate objRS.fields("DURATION").value = Duration objRS.fields("DESCRIPTION").value = Description objRS.fields("PROCESSID").value = "" objRS.fields("PROCESSNODE").value = "" objRS.fields("TIMELESS").value = Timeless 'objRS.fields("RECURRING").value = 'objRS.fields("ACTIVITYBASEDON").value = "" objRS.fields("USERID").value = UserID objRS.fields("USERNAME").value = UserName objRS.fields("ORIGINALDATE").value = OrigDate objRS.fields("RESULT").value = "" objRS.fields("RESULTCODE").value = "" objRS.fields("CREATEDATE").value = CreateDate objRS.fields("CREATEUSER").value = CreateUser objRS.fields("MODIFYDATE").value = ModifyDate objRS.fields("MODIFYUSER").value = ModifyUser objRS.fields("COMPLETEDDATE").value = CompDate objRS.fields("COMPLETEDUSER").value = CompUser objRS.fields("NOTES").value = Notes objRS.fields("LONGNOTES").value = Notes objRS.fields("ATTACHMENT").value = Attachment 'objRS.fields("USERDEF1").value = "" 'objRS.fields("USERDEF2").value = "" 'objRS.fields("USERDEF3").value = "" objRS.fields("TICKETID").value = ""
objRS.update objRS.close
set objRS = Nothing set objslxdb = nothing
***** |
|
|
|
Re: Create a note via scripting
Posted: 25 May 07 2:27 AM
|
fiogf49gjkf0d Hi Lou,
Code looks good to me, so I will offer a couple of silly points of things that have happened to me and may be causing issues (please don't take offense if you feel I am being a bit obvious!)
1) Is the accountid that gets filled in the correct accountid for the account notes/history you are looking at! 2) Is the history type you are filling in 262156 (If so its a DBChange and is hidden by the filter) 3) ActivityID can be left blank (I think this is only for filling in when the history was created by completing an activity) 4) Make sure that the notes variable does not run over 254 chars else you will get an error when pushing it into the NOTES field (this is not why its not showing up though)
Thats all I got, short of wondering if you have made any changes to the notes/history tab?
One thing that may be worth trying is to put in a description that is very unique. Make sure it reaches the database. Then create a new contact group with a condition of history.description = unique value. If it finds your contact, you would then know that at least SLX can see the history even if it can't display it!
Good Luck
Nick
|
|
|
|
Re: Create a note via scripting
Posted: 25 May 07 7:41 AM
|
fiogf49gjkf0d AHA! There was a sneaky typo in the "TYPE" field. I'm using 262148 now, and everything is fine. Thanks for the list of things to check!
Lou  |
|
|
| |
|