0
votes

I need to create a button in Lotus Notes mail stationary which will insert a text and then the button is deleted from the message.

In the button I have:

res := @Prompt([OkCancelList]; "Is it OK?"; "Select result"; " ";"OK":"Failed":"");
@If(res ="OK"; 
    @Command([EditGotoField]; "Body") + @Command([EditInsertText]; "Everything is fine); 
    @Command([EditGotoField]; "Body") + @Command([EditInsertText]; "Not so good mate"));

This part works fine, but I am not sure how to delete the button after click. Usually works @Command([EditClear]) but not in this case when I use @Command([EditGoToField]) in the formula.

I suppose i need to use GoToField again with the correct button identifier and then run EditClear, but I do not know where to find it, or if there is another way to do it... Ideas?

Thank you.

2

2 Answers

1
votes

Assuming you have the button in field Body and nothing else that have to remain
then change your code to:

@Command([EditGotoField]; "Body");
@Command([EditSelectAll]);
res := @Prompt([OkCancelList]; "Is it OK?"; "Select result"; " ";"OK":"Failed":"");
@If(res ="OK"; 
     @Command([EditInsertText]; "Everything is fine"); 
    @Command([EditInsertText]; "Not so good mate"));

It selects the content of Body (including button) and replaces it by the new text.

0
votes

Assuming your document is (or could be put into) edit mode, you could still have the button, but have the button in it's own paragraph (or table cell) with a hide-when formula of of MySpecialButtonPressed!="", and then include the line

FIELD MySpecialButtonPressed := @Now;

in the button code.

(Edit: changed test from =1 to !="", then changed the set value from 1 to @Now because Notes doesn't store Boolean values. Unless you're sending out millions of these, the cost of using dates instead of numbers less than the benefit of having more specific information in case you need it.)