I need to include a button in a note I’m sending via lotusscript and while I know of the technique of having static buttons in a document and importing the field, I need a dynamic button, one that can be generated on the fly. Anyone know how to do this?
Subject: Dynamic Button via LotusScript
You can’t, at least not without resorting to DXL or the C API (or a third-party product that does the C API stuuf for you, like the Midas Rich Text LSX).
Subject: Dynamic Button via LotusScript
As Stan suggested, this isn’t possible without resorting to API or 3rd party utilities.
However you can get semi-dynamic buttons by storing a list of instructions to perform in a field, and coding a generic button that reads the content of the field and runs different code depending on the instructions.
How complex this gets depends on your application / requirements, but for simple tasks this can be quite effective. It also feels a little like you are a programming pioneer developing a simple programming language all of your own.
So for example your instructions could show:
“CONFIRM|Are you sure you want to respond?”
“EMAIL|Admin@company,Email received,I have receieved the email.”
“SET FIELD|Status,Confirmed”
“CLOSE|”
And your button code would do something like:
…
instructions=doc.instructions
for x = 0 to ubound(instructions)
posBar = instr(instructions(x),“|”)
if posBar <> 0 then
thisInstruction = left$(instructions(x), posBar-1)
Select Case thisInstruction
Case "CONFIRM":
retVal = Msgbox .......
if retVal = 7 then
Exit Sub
End If
Case "EMAIL":
set emailDoc = db.createDocument
.....
Case "SET FIELD":
call NotesDOcument.ReplaceItemValue(....
etc.
HTH - Rufus.