Lotus notes lotus notes中按钮的公式
我在电子邮件中添加了一个按钮 单击按钮后,将运行以下公式:Lotus notes lotus notes中按钮的公式,lotus-notes,lotus-formula,Lotus Notes,Lotus Formula,我在电子邮件中添加了一个按钮 单击按钮后,将运行以下公式: @If(disablebutton="1"; @Return(@Prompt([Ok];"";"Thank you but you have already clicked once! :) ")); @Prompt([Ok];"";"Thank you for the click! :) ")); @MailSend( "abc@xyz.com"; ""; "" ; "I will be present at the
@If(disablebutton="1";
@Return(@Prompt([Ok];"";"Thank you but you have already clicked once! :) "));
@Prompt([Ok];"";"Thank you for the click! :) "));
@MailSend( "abc@xyz.com"; ""; "" ; "I will be present at the event!" ;
"" ; "" ; [PriorityNormal] );
FIELD disablebutton:="1";
上述公式的基本作用如下:
if(disableButton is 1){
Open prompt : you have already clicked and return without executing anything ahead
}else{
Open prompt : Thank you for the click!
}
send email to the specified email address with specified subject
set disableButton = 1
因此,当收件人打开电子邮件时,上面的公式限制收件人只单击一次按钮,结果只有一封邮件发送到指定的电子邮件地址
然而,问题是,如果用户关闭邮件并再次打开,则从一开始就运行相同的公式,从而有效地允许收件人再次发送邮件
因此,通过关闭和打开邮件并再次单击按钮,他可以有效地将尽可能多的邮件发送到指定的电子邮件地址
如何应对?我希望disableButton的值永久保留,以便邮件只发送一次 在公式末尾添加以下行:
@If(@IsDocBeingEdited;
@PostedCommand([FileSave]);
@Do( @PostedCommand([EditDocument]);
@PostedCommand([FileSave]);
@PostedCommand([EditDocument])))
仅当文档处于编辑模式且已保存时,字段设置才会保留在文档中。通常,当用户阅读电子邮件时,电子邮件处于阅读模式。使用@命令([EditDocument])代码>您可以在读取和编辑模式之间切换
如果电子邮件处于编辑模式,我们只需要保存文档
如果电子邮件处于读取模式,我们将文档更改为编辑模式,保存文档并将其设置回读取模式。尝试在LotusScript中实现相同的功能。在那里调试要容易得多
dim uiws as new notesuiworkspace
dim uidoc as notesuidocument
dim disablebutton as string
dim doc as notesdocuemnt
set uidoc = uiws.currentDocument
disablebutton = uidoc.fieldgettext("DisableButton")
if(strcompare(disablebutton,"1",5)=0 then
messagebox {Thank you but you have already clicked once! :)}
else
call sendMail(uidoc.document)
set doc =uidoc.document
call doc.replaceitemvalue("DisableButton","1")
call doc.save(true,false)
call uidoc.close()
end if
SendMail功能也需要实现。此解决方案会抛出一个额外的对话框,询问“是否要保存更改”。。。是否有方法阻止该对话框?否则你的建议就行了。。。谢谢..使用@PostedCommand(…)
它将不再被询问,因为这些行肯定会在所有其他行之后执行。我将答案从@Command(…)
更改为@PostedCommand(…)
。感谢您的更新。。但我仍然会看到“是否要保存更改?”对话框。我改进了我的答案:现在只有当文档处于读取模式时,它才会在编辑/读取模式之间切换。这样你就不会再按按钮问“你想保存更改吗?”。