Hi,Further to my other post:-
I’ve given up with formula and decided to write a LotusScript agent to populate the SalesRep field…
This is to cover the case of the user working with a local copy, whereby lookups to the address book fails (it works fine when connected)…
I’m trying to use the ‘OnChange’ event to cover this, then it runs an agent called Prompt.
Unfortunately, my first Eval statement never seems to work. In fact, it doesn’t seem to get set to anything! (not even blank).
Any ideas? I’m really scratching my head here:-
Declarations
Dim ukpin As String
Dim Eval As Variant
Dim Eval2 As Variant
Main Code
Sub Initialize
Dim workspace As New NotesUIWorkspace
Dim response As Variant
Dim dialogBox As String
Dim userName As String
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim Doc As NotesDocument
Set Doc =uidoc.Document
Dim Continue As Variant
If Doc.SalesRep(0) = "" Then
continue = False
Else
Dim SalesRep As Variant
SalesRep = Doc.SPName
Eval = Evaluate(|@DbLookup("":"";"85255F7E:006405B0";"($Users)";"| + doc.SPName(0) + |";"PIN")|,doc)
'copied stuff
'Eval = Evaluate(|@DbLookup( "": "NoCache" ; ""; "(Customer)";"| + doc.Comp(0) + |";14)|,doc)
'Doc.QuoteType = Eval(0)
'end copied stuff
Dim ukpin As String
ukpin = Eval(0)
Eval2 = Evaluate(|@IfError(@DbLookup("":"";"86256395:004EDFB0";"(PeopleByPin)";ukpin;"InternetAddress");"True")|)
'Dim Eval3 As Variant
'Eval3 = Evaluate(|@If(@IsError(Eval2); "True"; "False"|)
If Eval2(0) = "True" Then
userName = "@companyname.com"
dialogBox = "Please enter the Sales Persons internet email address"
response = workspace.Prompt (PROMPT_OKCANCELEDIT, _
"For example this address should end @companyname.com", _
"Make changes here, if necessary, then click OK to continue or Cancel to quit.", _
userName)
'If Isempty (response) Then
'Messagebox "Name not added.", , dialogBox
'Else
'userName = response
'Messagebox "Thank you, " + userName + ". Your name has been added.", , _
'dialogBox
doc.SPemail = response
Else
doc.SPemail = Eval2
End If
End If
End Sub
It’s driving me mad!