Hi,
this might be a very simple question, and might allready have been answered somewhere, but I could not find the solution on in this forum, so I thought I would ask.
I’m developing a customer management database, that is used to staro information of customers and their information, including email addresses. What I would like to create an action that would open a new email memo with address(es) selected from a view in the To: -field. Less than surprisingly I can create an action that opens a new memo, but haven’t been able to figure out a way to access the SendTo -field on the memo. Can this be done?
The point is to make it easy for people to use the email addresses in the database. If what I’m trying to do is impossible, alternative solutions would be appreciated, for example a good way to export information from my application to the personal address book?
Than you for your help,
Kaisa
Subject: Creating an action to compose email to selected address
From the Domino Designer help:
@SetField( fieldName ; value )
Parameters
fieldName
The name of the field whose value you want to set, enclosed in quotation marks.
value
The value you want to give to fieldName. The value must be the same data type as the field; for example, if the field is numeric, the value must be a number.
Usage
This function is most useful in agents, hotspot buttons, actions, and toolbar buttons. It does not work in column, selection, hide-when, window title, or form formulas.
With Release 6, you no longer need to declare the field receiving the assignment prior to setting its value with @SetField. For R5 or earlier clients, declare the field at the beginning of the formula, as follows:
FIELD Fieldname:=Fieldname;
The field that @SetField creates and assigns the specified value to if the specified field does not exist in the document is not visible to the user. You can remove a field added to a form this way using the @DeleteField function.
Language cross-reference
FieldSetText method of LotusScript NotesUIDocument class
ReplaceItemValue method of LotusScript NotesDocument class
replaceItemValue method of Java Document class
Subject: RE: Creating an action to compose email to selected address
I’ve tried using @SetField, but it doesn’t work. I To clarify what I want to do:
The email address is in a field called Email on document A, in database A. I want to set this value to the SentTo -field on Document B in database B. Document B is a new email memo, database B is the Notes email database. To my understanding @SetField doesn’t work between databases or even documents.
@SetDocField works between documents at least, but requires the reference of the other document, and I haven’t been able to find a way to find out the reference of the newly created email memo, so I can’t use it either.Any Ideas on how to find out the ref (UNID) I need?
Thanks,
Kaisa
Subject: RE: Creating an action to compose email to selected address
Below is a lotus script function that does this for you. You call it like this:
Dim uiwork As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = uiwork.CurrentDocument
Call CreateMemo( uidoc.document.GetItemValue(“EMailAddress”)(0) )
or you can use:
Call CreateMemo( uidoc.FieldGetText( “EMailAddress” ) )
Here is the function:
Sub CreateMemo( SendTo$ )
Dim s As New NotesSession
Dim uiwork As New NotesUIWorkspace
Dim uidoc As notesuidocument
On Error Goto errorHandling
MailFile$ = s.GetEnvironmentString( "MailFile", True)
MailServer$ = s.GetEnvironmentString( "MailServer", True )
Set uidoc = uiwork.ComposeDocument( MailServer$, MailFile$, "Memo" )
Call uidoc.FieldSetText( "SendTo", SendTo$ )
Call uidoc.FieldSetText( "EnterSendTo", SendTo$ )
Exit Sub
errorHandling:
Print "CreateMemo reports:"
Print Cstr(Err) & " " & Error$
Resume Next
End Sub
Subject: RE: Creating an action to compose email to selected address
If you are unsure how to use functions, then just paste the following into your button. You need to change the ‘EMailAddress’ to the field name that contains the email address:
Dim s As New NotesSession
Dim uiwork As New NotesUIWorkspace
Dim uidoc As notesuidocument
MailFile$ = s.GetEnvironmentString( "MailFile", True)
MailServer$ = s.GetEnvironmentString( "MailServer", True )
Set uidoc = uiwork.CurrentDocument
SendTo$ = uidoc.document.GetItemValue("EMailAddress")(0)
Set uidoc = uiwork.ComposeDocument( MailServer$, MailFile$, "Memo" )
Call uidoc.FieldSetText( "SendTo", SendTo$ )
Call uidoc.FieldSetText( "EnterSendTo", SendTo$ )
p.s.
I am not sure if ‘EnterSendTo’ is needed. Could be my mail file is customized (I am at work).
Subject: RE: Creating an action to compose email to selected address
Thank you very much, that does it!
I really appreciate your help.
Kaisa