11/25/2024 2:21:26 PM
|
|
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!
Forum to discuss SalesLogix synchronization and remote database management. View the code of conduct for posting guidelines.
|
|
|
|
Agent not work in slx 6.2.5
Posted: 24 Feb 07 7:17 AM
|
fiogf49gjkf0d Hi my problem ist, the agent will not work.
I've create a agent with the action "ActiveScript" and in the Family "System:MyScript" are a Vbscript. In this script I dont use the "application" object and have no msgboxes inside.
So what I want is, I'll send only an email to various Users.
I've create an Outlookinstance with CreateObject("Outlook.Application") and so on. I wait after synchronistion is finisch, I read the synchlog file and see there It works vere well in Client Option when I set in DBopen: "ActiveScript System:MyScript"
here are the LogFile: U[24.02.2007 14:00:05]Transferring files to profile SynchWMtest. U[24.02.2007 14:00:05]File transfer completed. U[24.02.2007 14:00:05]Running any pending agents... U[24.02.2007 14:00:05]Agent "test1" was started. U[24.02.2007 14:00:05]1 agent was started. U[24.02.2007 14:00:05]Conflict information purged. U[24.02.2007 14:00:05]Conflict information stored. U[24.02.2007 14:00:05]Sync Cycle completed. U[24.02.2007 14:00:05]
Here my code: =================== Start ========================================= Option Explicit
Private Const ClassName = " in Class SLX_Outlook"
Private m_Items 'As Outlook.Items Private m_OL 'As Outlook.Application Private m_ns 'As Outlook.Namespace Private m_Folder 'As Outlook.MAPIFolder Private mEmailCategorie 'As String
Const olFolderCalendar = 9 Const olFolderContacts = 10 Const olFolderDeletedItems = 3 Const olFolderDrafts = 16 Const olFolderInbox = 6 Const olFolderJournal = 11 Const olFolderJunk = 23 Const olFolderNotes = 12 Const olFolderOutbox = 4 Const olFolderSentMail = 5 Const olFolderTasks = 13 Const olPublicFoldersAllPublicFolders = 18 Const olFolderConflict = 19 Const olFolderLocalFailure = 21 Const olFolderServerFailure = 22 Const olFolderSyncIssue = 20
'olImportance Const olImportanceHigh = 2 Const olImportanceLow = 0 Const olImportanceNormal = 1
Sub Main()
Dim objSLXDB Dim rs Dim sql1 Dim Weiterleitung Dim EmailTo Dim VERANTWORTLICHER Dim mOutlook Dim mSubject Dim mBody
OutlookLogon "SLX-Kat" 'mOutlook
EmailTo = "trustadmin" SendMail EmailTo, "Test Subject", "Test Body", "SLX-Report"
OutlookLogoff
End Sub
Public Function SendMail(ByVal Username, ByVal Subject, ByVal Body, ByVal Kategorie) Dim mInboxFolder ' As MAPIFolder Dim mNewEmail ' As MailItem Dim mRecipientObj ' As Recipient Dim mRecipient ' As Variant Dim vbcrlf Dim mAux
vbcrlf = Chr(13) & Chr(10) SendMail = True
On Error Resume Next Set mInboxFolder = m_OL.Session.GetDefaultFolder(olFolderInbox) If Err.Number <> 0 Then 'do nothing.... Exit Function End If Set mNewEmail = mInboxFolder.Items.Add
If Not IsArray(Username) Then Username = Array(Username)
mNewEmail.Subject = Subject mNewEmail.Body = Body
For Each mRecipient In Username Set mRecipientObj = m_OL.Session.CreateRecipient(mRecipient) mRecipientObj.Resolve If Not mRecipientObj.Resolved Then Set mRecipientObj = m_ns.CurrentUser mNewEmail.Body = "The Recipient " & mRecipient & " is unknow. please check!" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & Body mNewEmail.Recipients.Add mRecipientObj.Address Else mNewEmail.Recipients.Add mRecipientObj End If Set mRecipientObj = Nothing Next
mNewEmail.Importance = olImportanceHigh mNewEmail.Categories = mEmailCategorie mNewEmail.Send SendMail = False End Function
Public Function CurrentUser() 'As String On Error Resume Next CurrentUser = m_OL.Session.CurrentUser.Name End Function
Private Function OutlookLogon(ByVal EmailKategorie) Dim mAux 'As Outlook.MAPIFolder
On Error Resume Next mEmailCategorie = EmailKategorie Set m_OL = CreateObject("Outlook.Application") Set m_ns = m_OL.GetNamespace("MAPI") m_ns.Logon End Function
Private Sub OutlookLogoff() Set m_Items = Nothing Set m_Folder = Nothing
On Error Resume Next m_ns.Logoff Set m_ns = Nothing Set m_OL = Nothing End Sub
=================== End =========================================
|
|
|
|
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!
|
|
|
|
|
|
|
|