Reputation: 2617
I ran into an issue with the @ClientType
formula in Lotus Notes. This formula should show the client type. From the Lotus help:
Returns "Notes" if the client type is a Lotus Notes client Returns "Web" if the client type is a Web browser
@ClientType is useful within database formulas, form formulas, buttons in forms, and "hide-when" formulas. Do not use @ClientType in column formulas. @ClientType always returns "None" when executed in a server background agent.
However if I run this code in an agent or action hotspot in the client:
x = Evaluate("@ClientType")
MsgBox x(0)
The result is "Web".
And if I use the notesDocument.RenderToRTItem( notesRichTextItem ) or notesDocument.ConvertToMIME( conversionType, options ) function, the @ClientType formula is also evaluated to "Web"
This is relevant because some fields in the document form in the document library use this formula in the hide when options. When a document is rendered to rich text or to MIME, this field is not included.
Is there any way to control the behavior of this formula? My only other option is to change the hide when formula's, but I would rather leave the design of the database as is.
Upvotes: 1
Views: 969
Reputation: 1
It seems that the solution is to convert the session's convertmime flag to true after your doc.converttomime call
Code below is run from a scheduled agent. Test 1 returns 'Nothing' Test 2 returns 'Web' Test 3 returns 'Nothing'
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim vntClientType As Variant
Set db=s.Currentdatabase
On Error GoTo ErrorHandling
vntClientType = Evaluate("@ClientType")
MessageBox " Test 1 before converttomime " & vntClientType(0)
Set doc=New NotesDocument(db)
Call doc.converttomime
vntClientType = Evaluate("@ClientType")
MessageBox " Test 2 after converttomime" & vntClientType(0)
s.convertmime=True
vntClientType = Evaluate("@ClientType")
MessageBox " Test 3 after s.convertmime= true" & vntClientType(0)
Exit Sub
ErrorHandling:
Error Err, Error & " - " & ", at line " & Erl & { in "} & GetThreadInfo( 1 ) & {"}
End Sub
Upvotes: 0
Reputation: 79
Even though it's working on a computed field, if your agent gets that document handle then you can get from the computed field. Whereas it will not work in column formula which is already mentioned in help document.
Upvotes: 0