Liferay: importing documents from a Domino server using BackgroundTask

The "current and Prevoius" table tasks.

Through the BackgroundTask framework available from the 6.2 release of Liferay has been possible to manage an import process.
Here you can find the code of the control panel portlet I developed and which imports the documents from a Notes database located on a remote Domino server: GitHub project

You can find also a wiki for the project (italian only, at the moment).

Please note: the portlet is “Under construction”…

Stamp a barcode over a fax page received with RightFax in a Lotus Notes workflow

A company receives orders via a RightFax server and a Lotus Notes gateway put the received faxes in a mail-in database Lotus Workflow enabled.

First, we need to stamp a unique barcode (the order identifier) in each fax page, then the order is loaded in the company ERP (IBM iSeries). The data entry operator loads the order data and, with a barcode scanner, associates the order identifier to the order.

So, after the order arrives in the mail-in database the Lotus Workflow PostInitByMail_ event is triggered.

This event reads (GetHistory function) the Fax identifier from the history file attached in the mail containing the pdf fax also and save the Fax id in a notes document field.

Then it calls the BarCode java agent that stamps in each page of the attached fax the Fax ID using a barcode char. The same agent detach and remove the original pdf and attaches the bar coded one.

The received fax order workflow

The received fax order workflow

The customized PostInitByMail_ function.

You can find this function in the Script Library ‘Os Application Events‘ part of a Lotus Workflow application.

Private Function PostInitByMail_(CoverDocument As NotesDocument, MainDocument As NotesDocument, Memo As NotesDocument)

    Dim sess As New NotesSession
    Dim db As NotesDatabase
    Dim agent As NotesAgent
    Dim doc As NotesDocument
    Dim item As NotesItem
    Dim paramid As String

    Call GetHistory(MainDocument)

    Set db = sess.CurrentDatabase
    Set agent = db.GetAgent("(BarCoder)")

    paramid = MainDocument.Noteid

    Call Agent.Run(paramid)

End Function

Continua a leggere

Failover Automatico del client Notes tramite HidePromptFailoverInc=1

IBM Lotus Domino

Che succede all’utente notes quando un server di un cluster domino è fuori uso?

Di solito gli appare una finestra di dialogo che gli suggerisce di provare ad usare un’altra replica.

Di fatto l’utente “va nel panico” e alza il telefono dell’Help Desk.

Un nuovo parametro disponibile a partire dalla release 8 esegue il failover automaticamente e in maniera trasparente all’utente.

Aggiungete manualmente al notes.ini degli utenti HidePromptFailoverInc=1 o potete “distribuire” il parametro tramite policy con un documento di Desktop Settings aggiungendo il parametro al tab “Custom”.

Quando un’azienda cambia dominio

Da qui a breve un’azienda con qualche migliaio di utenti cambierà il suo dominio di posta.

Gli utenti di posta sono sparsi geograficamente su server Domino, Exchange e  in hosting presso alcuni ISP.

La Fastnet ha ricevuto l’incarico di seguire il progetto di migrazione e allo scopo ha implementato un laboratorio virtuale basato su VMware ESX in cui è stata riprodotta l’infrastruttura di messaggistica del cliente.

Oltre a supportare la fase di coesistenza del vecchio dominio e del nuovo e di prevedere il consolidamento di alcuni domini, ci è stato anche richiesto di prevedere la modifica del cambio dell’indirizzo internet sulla postazione di ciascun utente.

Gli utenti usano come client di posta sia Lotus Notes, che Microsoft Outlook e Outlokk Express.

Per gli utenti Lotus Notes che dovranno cambiare il proprio email da <nome.cognome@vecchiodominio.com> a <nome.cognome@nuovodominio.com> si utilizzerà del codice LotusScript associato ad un pulsante che gli utenti troveranno all’interno di una email.

L’utente che riceve tale email fa click sul pulsante in essa contenuto e lo script provvederà a modificare con il nuovo dominio tutti i campi contenente l’email address presenti nei documenti di Location del proprio personal address book. La procedura invia anche un email di conferma ad un amministratore.

Sub Click(Source As Button)
Dim s As New NotesSession
Dim view As NotesView
Dim doc As NotesDocument
Dim newDomain As String
Dim oldDomain As String
Dim toNotify As String
toNotify = "user admin/xxxxxxx"
newDomain = "@newdoamin.com"
oldDomain = "@olddomain.com"
sNamesLine=s.GetEnvironmentString("NAMES", True)
nPos = Instr(sNamesLine, ",")
If nPos > 0 Then
	sNamesLine = Left$(sNamesLine, nPos-1)
Else
	sNamesLine = "names.nsf"
End If
Set db = New NotesDatabase( "",sNamesLine )
If Not(db.isOpen) Then
	Messagebox "Non è stato possibile aggiornare automaticamente il sistema. Può gentilmente contattare l'help desk? Spieghi che ha ricevuto un codice KO55"
	Exit Sub
End If

Set view = db.GetView("Locations")
Dim email, domain, predomain As String
Dim message As String
message = ""

Set doc = view.GetFirstDocument
While Not doc Is Nothing
	If doc.HasItem("ImailAddress") Then
		email=doc.ImailAddress(0)
		domain = Strtoken(email, "@", 2)
		If domain = oldDomain Then
			predomain = Strtoken(email, "@", 1)
			email = predomain + newDomain
			message = message + " Aggiornata la location: " + doc.Name(0) + Chr(10)
			Call doc.ReplaceItemValue("ImailAddress", email)
			Call doc.Save(True, False)
		End If
	End If
	Set doc = view.GetNextDocument(doc)
Wend

Dim arrSendTo(0 To 0) As String
Dim arrCopyTo(0 To 0) As String
Dim arrBlindCopyTo(0 To 0) As String
Dim txtSubject As String
Dim txtBody As String

txtSubject = {Notifica aggiornamento location per } + s.CommonUserName
txtBody = message
arrSendTo(0) = toNotify
arrCopyTo(0) = {}
arrBlindCopyTo(0) = {}

'Try sending the mail
If message <> "" Then
	If fnSendMailWithDocLink(arrSendTo,arrCopyTo,arrBlindCopyTo,txtSubject,txtBody,Nothing) Then
		'Success
		Print "Email spedita"
		Messagebox "Aggiornamenti effettuati. Grazie per la collaborazione."
	Else
		'Failure
		Print "Email NON spedita"
		Messagebox "Aggiornamenti effettuati. Grazie per la collaborazione."
		Messagebox "Non è stato possibile notificare automaticamente il responsabile di sistema. Può gentilmente contattare l'help desk? Spieghi che ha ricevuto un codice OK88"
	End If
Else
	Messagebox "Non sono necessari aggiornamenti. Grazie per la collaborazione."
End If
End Sub

Function fnSendMailWithDocLink(pSendTo() As String, pCopyTo() As String, _
pBlindCopyTo() As String, Byval pSubject As String, Byval pBody As String, _
pDocLink As NotesDocument) As Integer

On Error Goto ErrorHandler

Dim session As New NotesSession
Dim db As NotesDatabase
Dim docMemo As NotesDocument
Dim rtitemBody As NotesRichTextItem
Set db = session.CurrentDatabase
Set docMemo = db.CreateDocument
docMemo.Form = "Memo"
docMemo.SendTo = pSendTo
docMemo.CopyTo = pCopyTo
docMemo.BlindCopyTo = pBlindCopyTo
docMemo.Subject = pSubject

Set rtitemBody = docMemo.CreateRichTextItem("Body")

Call rtitemBody.AppendText(pBody)

If Not(pDocLink Is Nothing) Then
	Call rtitemBody.AddNewLine(2)
	Call rtitemBody.AppendText({Click to open the document =>})
	Call rtitemBody.AppendDocLink(pDocLink, "Click to open the document")
End If
Call docMemo.Send(False)
fnSendMailWithDocLink = True
Exit Function

ErrorHandler:
'Some error occurred. Handle errors below...
'...
'...
'...
'Return false, because an error occured
fnSendMailWithDocLink = False
Exit Function 'Abnormal exit
End Function

Nel caso invece di Outlook e Outlook Express le cose sono leggermente più complicate soprattutto per le diverse versioni dei programmi utilizzate.

Allo scopo ho sviluppato uno script che verrà eseguito sui vari pc nella fase di logon.

Lo script che segue supporta Outlook su Windows 2000/XP e Vista.

Supporta Outlook Express su Windows 2000 e XP.

Non supporta (ma ci sto lavorando) Windows Mail (che su Vista sostituisce Outlook Express).

'==========================================================================
'
' NAME: OutEmailDomChg.vbs
'
' AUTHOR: Filippo Del Prete - Fastnet spa
' BASED ON: Multiple, Luke Edson, Edsontech
' DATE  : 23-12-2008
'
' COMMENT: VBScript to change domain part in Outlook email (2000 to 2007).
' from <no-change>@OLD_DOMAIN to <no-change>@NEW_DOMAIN
'
' IMPORTANT: Read Notes section
'
' You have a royalty-free right to use, modify, reproduce, and
' distribute this script file in any way you find useful, provided
' that you agree that the copyright owner above has no warranty,
' obligations, or liability for such use.
'
'==========================================================================

' *Notes*
' Outlook versions 2000, 2002(XP), 2003 and 2007 are supported
' Windows 2000/XP/2003/Vista are supported
' This script uses CDO.Message object to send an email: see Email settings below


' domain to manage
Const OLD_DOMAIN = "olddomain.com"
Const NEW_DOMAIN = "newdomain.com"


' Set constants for Registry
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002

' EMail settings
Const SMTP_SERVERNAME = "xxx.yyyy.it"
Const FROM_EMAIL = "f.delprete@zzzzzzz.it"
Const TO_EMAIL = "f.delprete@kkkkkkkk.it"


Dim objReg, strOutPath, strVerPath, strComputer, strEntryName, strVersion, strOut
Dim ArgObj
Dim objEnv ' as collection
Dim WshShell
Dim msgText
Dim msg
Dim OutlookInstalled
Dim OutExprInstalled


OutlookNotInstalled = False
OutExprNotInstalled = False

msg = "Looking for " & OLD_DOMAIN & " and trying to change in " & NEW_DOMAIN
wscript.echo msg
msgText = msgText & msg & vbCRLF

Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Set WshShell = WScript.CreateObject("WScript.Shell")

' Set Values for Registry information
strOutPath = "Outlook.Application\CurVer"
strVerPath = "SYSTEM\CurrentControlSet\Control\ProductOptions"
strOLProfKey = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
strOEProfKey = "HKCU\Software\Microsoft\Internet Account Manager\Account Name"
strEntryName = "ProductType"

' Read Environment Variables
strOS = WshShell.ExpandEnvironmentStrings("%OS%")
strUsername = WshShell.ExpandEnvironmentStrings("%USERNAME%")
strComputername = WshShell.ExpandEnvironmentStrings("%COMPUTERNAME%")

' check for Outlook installed
objReg.GetStringValue HKEY_CLASSES_ROOT, strOutPath, "", strOut
strOut = strOut & ""
If strOut = "" Then
	msg = "Outlook is not installed"
	wscript.echo msg
	msgText = msgText & msg & vbCRLF
	OutlookNotInstalled = True
End If

'check for Outlook Express
newAccountNum = WshShell.RegRead(strOEProfKey)
If newAccountNum = "" Then
	msg = "Outlook Express never used"
	wscript.Echo msg
	msgText = msgText & msg & vbCRLF
	OutExprNotInstalled = True
End if

If OutlookNotInstalled and OutExprNotInstalled Then
	msg = "Neither Outlook Express or Outlook used"
	wscript.Echo msg
	msgText = msgText & msg & vbCRLF
	Call SendTheEmail(TO_EMAIL,FROM_EMAIL,"Outlook change domain result: " & strUsername & " (" & strComputername & ")", SMTP_SERVERNAME, msgText)
	wscript.quit
End if

' check for Windows NT/2000/XP
If strOS = "Windows_NT" then

Else
	msg = "This script does not run on Windows 9X"
	wscript.echo msg
	msgText = msgText & msg & vbCRLF
	Call SendTheEmail(TO_EMAIL,FROM_EMAIL,"Outlook change domain result: " & strUsername & " (" & strComputername & ")", SMTP_SERVERNAME, msgText)
	wscript.quit
End If

' check for Workstation/Professional vs. Server versions
objReg.GetStringValue HKEY_LOCAL_MACHINE, strVerPath, strEntryName, strVer
If strVer = "WinNT" then
	msg = "This is a workstation"
	wscript.echo msg
	msgText = msgText & msg & vbCRLF
Else
	msg = "This is a Server - Quitting"
	wscript.echo msg
	msgText = msgText & msg & vbCRLF
	Call SendTheEmail(TO_EMAIL,FROM_EMAIL,"Outlook change domain result: " & strUsername & " (" & strComputername & ")", SMTP_SERVERNAME, msgText)
	wscript.quit
End if

If OutlookNotInstalled = False Then
	' Check for listing default Profile to determine if Profile exists
	objReg.getStringValue HKEY_CURRENT_USER, strOLProfKey, "DefaultProfile", strDefProf
	msg = "Declared Outlook DefaultProfile: " & strDefProf
	wscript.echo msg
	msgText = msgText & msg & vbCRLF

	strOLProfKey = strOLProfKey & "\" & strDefProf & "\9375CFF0413111d3B88A00104B2A6676"
	objReg.EnumKey HKEY_CURRENT_USER, strOLProfKey, arrProfileKeys

	If IsNull(arrProfileKeys) then 'If #3
		msg = "Profile does not exist"
		wscript.echo msg
		msgText = msgText & msg & vbCRLF
	Else
		msg = "Outlook Profile Exists"
		wscript.echo msg
		msgText = msgText & msg & vbCRLF
		If strOut = "Outlook.Application.11" or strOut = "Outlook.Application.10" then
			msg = "Outlook 2002/2003"
			wscript.echo msg
			msgText = msgText & msg & vbCRLF
			For Each subkey In arrProfileKeys
				strSubkeyPath = strOLProfKey & "\" & subkey
				' wscript.echo "strsubkey: " & strSubkeyPath
				' 001f300a value contains name of the service DLL file
				objReg.GetBinaryValue HKEY_CURRENT_USER, strSubkeyPath, "Email", emailValue
				strhexkeyvalue=""
				If Not IsNull(emailValue) Then
					For i = 0 To UBound(emailValue)
						' build string from hex values
						strhexkeyvalue = strhexkeyvalue & HexByte(emailValue(i))
					Next
					theEmail = Hex4ToString(strhexkeyvalue)
					theEmail = Mid(theEmail,1,Len(theEmail)-1)
					testRes = StrComp(OLD_DOMAIN,Trim(Mid(theEmail,InStr(1,theEmail,"@")+1)))
					if testRes = 0 then
						msg = "Email found in the old domain: " & theEmail
						wscript.echo msg
						msgText = msgText & msg & vbCRLF
						startEmail = Mid(theEmail,1,InStr(1,theEmail,"@"))
						newEmail = startEmail & NEW_DOMAIN
						msg = "Rewriting the email address with the new domain: " & newEmail
						wscript.echo msg
						msgText = msgText & msg & vbCRLF
						myEmailArray = StringToByteArray(newEmail, True)
						objreg.SetBinaryValue HKEY_CURRENT_USER, strSubkeyPath, "Email", myEmailArray
					Else
						msg = "Email found in a non-matching domain: " & theEmail
						wscript.echo msg
						msgText = msgText & msg & vbCRLF
					End if
					' Exit For
				End If
			Next
		Elseif strOut = "Outlook.Application.9" then
			msg = "Outlook 2000 - Da Testare"
			wscript.echo msg
			msgText = msgText & msg & vbCRLF
			For Each subkey In arrProfileKeys
				strSubkeyPath = strOLProfKey & "\" & subkey
				' wscript.echo "strsubkey: " & strSubkeyPath
				objReg.GetBinaryValue HKEY_CURRENT_USER, strSubkeyPath, "Email", emailValue
				strhexkeyvalue=""
				If Not IsNull(emailValue) Then
					For i = 0 To UBound(emailValue)
						' build string from hex values
						strhexkeyvalue = strhexkeyvalue & HexByte(emailValue(i))
					Next
					theEmail = Hex4ToString(strhexkeyvalue)
					theEmail = Mid(theEmail,1,Len(theEmail)-1)
					testRes = StrComp(OLD_DOMAIN,Trim(Mid(theEmail,InStr(1,theEmail,"@")+1)))
					if testRes = 0 then
						msg = "Email found in the old domain: " & theEmail
						wscript.echo msg
						msgText = msgText & msg & vbCRLF
						startEmail = Mid(theEmail,1,InStr(1,theEmail,"@"))
						newEmail = startEmail & NEW_DOMAIN
						msg = "Rewriting the email address with the new domain: " & newEmail
						wscript.echo msg
						msgText = msgText & msg & vbCRLF
						myEmailArray = StringToByteArray(newEmail, True)
						objreg.SetBinaryValue HKEY_CURRENT_USER, strSubkeyPath, "Email", myEmailArray
					Else
						msg = "Email found in a non-matching domain: " & theEmail
						wscript.echo msg
						msgText = msgText & msg & vbCRLF
					End if
					' Exit For
				End If
			Next
		Elseif strOut = "Outlook.Application.12" then
			msg = "Outlook 2007"
			wscript.echo msg
			msgText = msgText & msg & vbCRLF
			For Each subkey In arrProfileKeys
				strSubkeyPath = strOLProfKey & "\" & subkey
				' wscript.echo "strsubkey: " & strSubkeyPath
				objReg.GetBinaryValue HKEY_CURRENT_USER, strSubkeyPath, "Email", emailValue
				strhexkeyvalue=""
				If Not IsNull(emailValue) Then
					For i = 0 To UBound(emailValue)
						' build string from hex values
						strhexkeyvalue = strhexkeyvalue & HexByte(emailValue(i))
					Next
					theEmail = Hex4ToString(strhexkeyvalue)
					theEmail = Mid(theEmail,1,Len(theEmail)-1)
					testRes = StrComp(OLD_DOMAIN,Trim(Mid(theEmail,InStr(1,theEmail,"@")+1)))
					if testRes = 0 then
						msg = "Email found in the old domain: " & theEmail
						wscript.echo msg
						msgText = msgText & msg & vbCRLF
						startEmail = Mid(theEmail,1,InStr(1,theEmail,"@"))
						newEmail = startEmail & NEW_DOMAIN
						msg = "Rewriting the email address with the new domain: " & newEmail
						wscript.echo msg
						msgText = msgText & msg & vbCRLF
						myEmailArray = StringToByteArray(newEmail, True)
						objreg.SetBinaryValue HKEY_CURRENT_USER, strSubkeyPath, "Email", myEmailArray
					Else
						msg = "Email found in a non-matching domain: " & theEmail
						wscript.echo msg
						msgText = msgText & msg & vbCRLF
					End if
					' Exit For
				End If
			Next
		Else
			msg = "This is not a supported version of Outlook"
			wscript.echo msg
			msgText = msgText & msg & vbCRLF
		End if
	End if
End if ' If OutlookNotInstalled = False

If OutExprNotInstalled = False Then
	msg = "Outlook Express found: trying to update SMTP Email Address"
	wscript.echo msg
	msgText = msgText & msg & vbCRLF
	For i = 1 To (newAccountNum - 1)
		b = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\0000000" & i & "\"
		If (RegistryKeyExists(b)) Then
			theEmail = WshShell.RegRead ( b & "SMTP Email Address" )
			testRes = StrComp(OLD_DOMAIN,Trim(Mid(theEmail,InStr(1,theEmail,"@")+1)))
			if testRes = 0 then
				msg = "Email found in the old domain: " & theEmail
				wscript.echo msg
				msgText = msgText & msg & vbCRLF
				startEmail = Mid(theEmail,1,InStr(1,theEmail,"@"))
				newEmail = startEmail & NEW_DOMAIN
				msg = "Rewriting the email address with the new domain: " & newEmail
				wscript.echo msg
				msgText = msgText & msg & vbCRLF
				WshShell.RegWrite b & "SMTP Email Address" , newEmail, "REG_SZ"
			Else
				msg = "Email found in a non-matching domain: " & theEmail
				wscript.echo msg
				msgText = msgText & msg & vbCRLF
			End if
		Else
			msg = "Error: non existant registry key: " & b
			wscript.echo msg
			msgText = msgText & msg & vbCRLF
		End If
	Next
End If

Call SendTheEmail(TO_EMAIL,FROM_EMAIL,"Outlook change domain result: " & strUsername & " (" & strComputername & ")", SMTP_SERVERNAME, msgText)

'**********************************************************
Function HexByte(b)

HexByte = Right("0" & Hex(b), 2)

End Function

Public Function StringToByteArray(Data, NeedNullTerminator)

Dim strAll
strAll = StringToHex4(Data)
If NeedNullTerminator Then
	strAll = strAll & "0000"
End If
intLen = Len(strAll) \ 2
ReDim arr(intLen - 1)
For i = 1 To Len(strAll) \ 2
	arr(i - 1) = CByte("&H" & Mid(strAll, (2 * i) - 1, 2))
Next
StringToByteArray = arr

End Function

Public Function RmChr(string, remove)

Dim i, j, tmp, strOutput
strOutput = ""
for j = 1 to len(string)
	tmp = Mid(string, j, 1)
	for i = 1 to len (remove)
		tmp = replace(tmp, Mid(remove,i,1), "")
		if len(tmp) = 0 then exit for
	next
	strOutput = strOutput & tmp
next

RmChr = strOutput

End Function

Public Function StringToHex4(Data)

' Input: normal text
' Output: four-character string for each character,
' e.g. "3204" for lower-case Russian B,
' "6500" for ASCII e
' Output: correct characters
' needs to reverse order of bytes from 0432
Dim strAll
For i = 1 To Len(Data)
	' get the four-character hex for each character
	strChar = Mid(Data, i, 1)
	strTemp = Right("00" & Hex(AscW(strChar)), 4)
	strAll = strAll & Right(strTemp, 2) & Left(strTemp, 2)
Next

StringToHex4 = strAll

End Function

Public Function Hex4ToString(Data)

Dim strTemp
Dim strAll

For i = 1 To Len(Data) Step 4
	strTemp = Mid(Data, i, 4)
	strTemp = "&H" & Right(strTemp, 2) & Left(strTemp, 2)
	strAll = strAll & ChrW(CInt(strTemp))
Next

Hex4ToString = strAll

End Function

Sub SendTheEmail(toVar, fromVar, subjectVar, serverVar, bodyVar)

Set objEmail = CreateObject("CDO.Message")
objEmail.From = fromVar
objEmail.To = toVar
objEmail.Subject = subjectVar
objEmail.Textbody = bodyVar & vbCRLF & " script by FMDP - Fastnet Spa - 2008-2009"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = serverVar
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send

End Sub

Function RegistryKeyExists (RegistryKey)
'Ensure the last character is a backslash (\) - if it isn't, we aren't looking for a key
If (Right(RegistryKey, 1) <> "\") Then
	'It's not a registry key we are looking for
	RegistryKeyExists = false
Else
	'If there isnt the key when we read it, it will return an error, so we need to resume
	On Error Resume Next

	'Try reading the key
	WshShell.RegRead RegistryKey
	
	'Catch the error
	Select Case Err
		'Error Code 0 = 'success'
	Case 0:
		RegistryKeyExists = true
		'This checks for the (Default) value existing (but being blank); as well as key's not existing at all (same error code)
	Case &h80070002:
		'Read the error description, removing the registry key from that description
		ErrDescription = Replace(Err.description, RegistryKey, "")
	
		'Clear the error
		Err.clear

		'Read in a registry entry we know doesn't exist (to create an error description for something that doesnt exist)
		WshShell.RegRead "HKEY_ERROR\"

		'The registry key exists if the error description from the HKEY_ERROR RegRead attempt doesn't match the error
		'description from our RegistryKey RegRead attempt
		If (ErrDescription <> Replace(Err.description, "HKEY_ERROR\", "")) Then
			RegistryKeyExists = true
		Else
			RegistryKeyExists = false
		End If
		'Any other error code is a failure code
	Case Else:
		RegistryKeyExists = false
	End Select

'Turn error reporting back on
On Error Goto 0
End If

End Function

iPhone e Domino

Succede che il grande capo acquista un iPhone.

Poi chiede: “Dove sono le mie email? E l’agenda e la rubrica gestite dalla mia segretaria?”

Fino all’arrivo dell’iPhone il tutto stava memorizzato tranquillamente su un Guest SUSE SLES9 con Domino 7.0.3 ospitato su un cluster VMware.

Per far accedere un iPhone a Domino è disponibile da pochi giorni l’ultima versione del template di posta (8.0.2): la versione Ultra Lite per l’accesso via web alla posta/calendrio/rubrica di Lotus Domino.

Lotus iNotes UltraLite

Piccolo problema: Domino 8.x vuole SUSE SLES 10 e non 9.

Quindi:

  • ieri sera: clone (di sicurezza) del guest SLES9 con su Domino 7.0.3 e upgrade a SUSE SLES 10: liscio come l’olio.
  • stasera: nuovo clone (di sicurezza) del guest diventato SLES 10 e upgrade del Domino server alla release 8.0.2 + lingua italiana: liscio come l’olio.

Domani debutto di Domino sull’iPhone del boss.

Poi quando avrò finito di giocare, avanti con il progetto di iExtensions CRM sulla piattaforma Lotus Domino (ovviamente).

Risorse:

Find more information about the new DWA ultralite mode at the Domino 8.0.2 InfoCenter.

Upgrading to Notes and Domino 8.0.2

Aggiornare dinamicamente campi rich-text con LotusScript

Di seguito la traduzione di un articolo che illustra come gestire tramite LotusScript gli allegati in un campo rich-text sul documento Lotus Notes aperto sul front-end.

Aggiornare dinamicamente campi rich-text con LotusScript

Titolo originale: “Dynamically update Lotus Notes rich-text fields using LotusScript”

Autore: Amith Narera
11.20.2007

Una modifica effettuata su un documento Lotus Notes nel back-end viene solitamente riprodotta nel documento di front-end, ma u’eccezione a questo comportamento sono i campi di tipo rich-text. Per le modifiche ai campi rich-text, si deve chiudere il doumento Lotus Notes di front-end e aprirlo di nuovo usando il metodo NotesUIWorkspace.EditDocument. Comunque, questo fa “scatenare” tutti gli eventi associati alla form Lotus Notes. Questo tip aggira questo problema consentendo di aggiornare dinamicamente i campi rich-text del front-end senza chiudere e riaprire la form Lotus Notes principale.

A scopo esemplificativo, aggiungo l’attuale username Lotus Notes, l’ora di sistema e gli allegati (selezionati dall’utente Lotus Notes) al campo rich-text. Il seguente codice LotusScript consente anche di appendere item rich-text da un altro documento Lotus Notes (codice commentato).

Quello che segue è uno schema di come il codice LotusScript lavora:

  • Crea un documento Lotus Notes “di appoggio” nel back end usando il metodo db.CreateDocument.
  • Aggiunge un campo rich-text al documento.
  • Esegue tutte le azioni necessarie su questo campo rich-text .
  • Apre il documento Lotus Notes nel front-end coun una form “di appoggio” che contine solamente un campo rich-text (con lo stesso nome di quello creato nel secondo passaggio visto prima).
  • posiziona il cursore in questo campo rich-text, seleziona tutto il testo, e copia tutto negli appunti.
  • Chiude la form Lotus Notes “di appoggio”.
  • Va sul campo rich-text di destinazine sulla form Lotus Notes principale.
  • Incolla tutto dagli appunti.
  • Missione eseguita.

Questi sono gli step necessari per ottenere il risultato desiderato:

  1. Create a new form. Name it “Dummy Form.”
  2. Place a rich-text field, named “DummyRT” on it.
  3. Open your main Lotus Notes form where you’d like these updates to happen.
  4. Create a new Action button, and name it “Update RT Field.” You may use the LotusScript code anywhere. For the sake of simplicity I am using it in a button.
  5. Select LotusScript as the coding language and paste the code given below into it.
Sub Click(Source As Button)
   Dim workspace As New NotesUIWorkspace
   Dim session As New NotesSession

'COMMENT #######> UiDoc represents the currently open Fron End document, where the rich text field exists.
   Dim uidoc As NotesUIDocument

'COMMENT #######> Dummy UIDoc ---needed by the code
   Dim DummyUIDoc As NotesUIDocument
   Dim db As NotesDatabase

'COMMENT #######> Back End version of DummyUIDoc
   Dim DummyDoc As NotesDocument

'COMMENT #######>  RT Item in DummyDoc ---From where you would be pulling the changes
   Dim DummyRT As NotesRichTextItem
   Dim FilePath As Variant

   Set db = session.CurrentDatabase
   Set uidoc = workspace.CurrentDocument

   Set DummyDoc = db.CreateDocument

'COMMENT #######> Set Fields for Dummy Document
   DummyDoc.Form = "Dummy Form" ' NOTE: It shud be dummy form, not your main form.
   DummyDoc.SaveOptions = "0"

'COMMENT #######> Get the File path for the file to be attached
    FilePath = workspace.OpenFileDialog(True, "Select Files")

'COMMENT #######> Insert RT Field
   Set DummyRT = New NotesRichTextItem(DummyDoc,"DummyRT")

'COMMENT #######> Update the Field- as per your requirements
   Call DummyRT.AppendText(session.CommonUserName &amp; " - ")
   Call DummyRT.AppendText(Cstr(Now))
   Call DummyRT.AddNewline(1)

'COMMENT #######> Embed Selected Files, if Any
   If Not Isempty(FilePath) Then
      Forall CurrentFilepath In FilePath
         Call DummyRT.EmbedObject(1454,"", CurrentFilePath)
      End Forall
   End If
'COMMENT #######> You may also append an RT Item from any other document. eg.
%REM
    Dim RTItemB As NotesRichTextItem
    Set RTItemB = DocB.GetFirstItem("RTItemName")
    Call DummyRT.AppendRTItem(RTItemB)
%END REM

'COMMENT #######> Call this to commit all the RT Item Changes to the Document
   Call DummyRT.Update

'Here is the Trick
'****************************************************************************
   Set DummyUIDoc =  workspace.EditDocument(True,DummyDoc)
   Call DummyUIDoc.GotoField("DummyRT")
   Call DummyUIDoc.SelectAll
   Call DummyUIDoc.Copy
   Call DummyUIDoc.Close(True)
'COMMENT #######> Goto Main doc Rich Text Field (desitnation field)
   Call uidoc.GotoField("RTF")
   Call uidoc.Paste

'********************************************************************
   Messagebox "Process Completed Successfully.", 64, "Complete"
End Sub

Now — with a click of this action button — you can update the front end of your rich-text item in real-time without having to close and re-open the main Lotus Notes document. You can also apply the same logic to move contents of one rich-text item to the other rich-text item on the same form in real time — without having to re-open the front end document. If you’d like to do that, this code will help you:

   Call UIDoc.GotoField("FirstRT")
   Call UIDoc.SelectAll
   Call UIDoc.Copy
   Call uidoc.GotoField("SecondRT")
   Call uidoc.Paste

Come mettere un database Notes su un CD o DVD?

 Questa è la technote IBM numero: 1088423
 
Question
What steps are necessary to place a Lotus Notes® database on a CD, DVD, or any read-only media?
 
 
Answer
1. Open the database and press CTRL+SHIFT+F9. This key combination will refresh all views in the database including open views, hidden views, and private views. It is important to build the view indexes before copying the database to read-only media because if they are not created and stored in the .nsf file prior to transfer, Notes will attempt to create the indexes but won't be able to because it cannot write to the media.

    NOTE: If a view index is not built, pressing CTRL+SHIFT+F9 will cause Notes to build the view. If the view is already built, pressing CTRL+SHIFT+F9 will cause Notes to update the view, not rebuild it.

2. Create the full-text index for the database if you intend to queue the database using Notes full-text indexing capabilities. You can do this using the File > Full Text Search > Create Index command. This index must be created prior to placing the database on read-only media for the same reason described for view indexes in the step above.

3. Do an operating system level copy (use a DOS or OS/2 copy command) of the .nsf file (and the .ft if you created a full text index) from the writeable media to the read-only media to be used. Be sure that this is an operating system level copy, not a File > Database > Copy from within Notes, since using Notes to copy the database will remove the view indexes.

Consequences:
If you do not follow the above steps, the following error will display when launching the database on the CD or DVD:

    "Cannot write or create file (file or disk is read only)."

To remove the read-only setting, right-click the database icon, remove the read-only checkmark, and be sure to click Apply. If you receive a warning message, click Ignore All. This allows you to read the database without receiving any error message when opening, as long as you did a CTRL+SHIFT+F9 before copying the database.

About Notes/Lotus Domino® 8 releases:
In Notes/Domino 8 and later releases, there is a new On Disk Structure (ODS) of 48. If you upgrade or generate a database using this ODS, you will not be able to open the database in an earlier Notes/Domino 7 or 6.5 release and the following error will display:

    "Invalid nsf"

If you find that an ODS of 48 was used to copy a database to a CD or DVD, Product Development advises that you reverse the ODS to 43 using the "-r" switch, for example, Compact -r acme.nsf

Continua a leggere

Londra: iExtensions CRM Technical Boot Camp 2007

Dal 11 al 14 settembre sono stato a Londra, meglio dire Windsor, per una 3 giorni sul CRM iExtensions delle iEnterprises Inc., di cui Fastnet è il partner italiano.

{mosimage}E' stata presentata la versione 6.5 che contribuisce a rendere iExtesnions una soluzione di CRM altamente personalizzabile e sempre più integrata con il mondo IBM Lotus. 

Tra le novità più rilevanti segnalo il modulo Automation che consente una gestione molto sofisticata degli automatismi che una soluzione di crm richiede solitamente di implementare. 

Ad esempio: con il modulo Visite si gestiscono le visite relative a trattative presso i clienti. In tal caso è possibile attivare un automatismo che popoli automaticamente l'agenda personale con i dettagli della visita pianificata. 

Ulterirormente migliorata anche la possibilità di stampare in pdf  qualunque dato potendo personalizzare totalamente il formato di stampa.

A tenere il corso è stato il simpatico e competente Paul Sugg della iEnterprises Europe.

Nel corso ho installato la nuova versione e con i colleghi di altre countries europee abbiamo potuto sperimentare le nuove features con laboratori ad hoc.

La prima sera tutti insieme per una visita al centro di Londra sul London Eye e cena nell'ottimo ristorante del palazzo del Council. La sera successiva visita a Widsor con un collega belga e cena sulla riva dell'Eaton.

Areoporti come al solito snervanti per le severe (speriamo utili) norme di sicurezza. 

Continua a leggere