2013-10-31 70 views
1

我在电子邮件中添加了一个按钮。莲花笔记按钮公式

在按钮的点击下面的公式运行:

@If(disablebutton="1"; 
    @Return(@Prompt([Ok];"";"Thank you but you have already clicked once! :) ")); 
    @Prompt([Ok];"";"Thank you for the click! :) ")); 
@MailSend("[email protected]"; ""; "" ; "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的值永久保存,以便邮件只发送一次。

回答

3

把下面的行的公式的末尾:

@If(@IsDocBeingEdited; 
    @PostedCommand([FileSave]); 
    @Do( @PostedCommand([EditDocument]); 
      @PostedCommand([FileSave]); 
      @PostedCommand([EditDocument]))) 

字段设置保持停留在文件只有当文件在编辑模式下,它被保存。通常,当用户阅读他们的电子邮件时,电子邮件处于阅读模式。使用@Command([EditDocument]);可以在读取和编辑模式之间切换。

如果电子邮件是在编辑模式,我们只需要保存文件。

如果电子邮件是请阅读模式,我们将文档更改为编辑模式,保存文档并将其设置回读取模式。

+0

此解决方案会抛出一个额外的对话框询问“是否要保存更改或不是”...有没有办法阻止对话框?否则你的建议工作得很好......谢谢.. – Nik

+0

使用'@PostedCommand(...)'它不会再问你了,因为这些行将在所有其他行之后执行。我将我的答案从'@Command(...)'更改为'@PostedCommand(...)'。 –

+0

感谢您的更新..但我仍然得到“你想保存更改吗?”对话框.. – Nik

0

尝试在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函数也需要实现。