Button in Lotus Notes that automatically forwards en email with attachment - lotus-notes

I'm trying to make a button in IBM Notes that automatically forwards emails with attachments to a specific address.
I have looked at 2 previous examples on this website but none of them are working for me and I get the mail forwarded to myself.
Can anyone help?
The 2 codes I've tried are:
_From := #Text(From);
#Command([MailForward]);
#Command([EditNextField]);
#Command([EditInsertText]; _From);
#Command([EditGotoField]; "Body");
#Command([EditInsertText]; "Your text" + #NewLine + "goes here...")
and
FIELD SendTo:= "person#mail.com" ;
#Command( [MailForwardAsAttachment] )
The IBM Notes version I'm using is # 9.
Thank you

Use the first example and change it to:
#Command([MailForward]);
#Command([EditInsertText]; "person#mail.com");
#Command([EditGotoField]; "Body");
#Command([EditInsertText]; "Your text" + #NewLine + "goes here...")
Replace the email address in second code line with your specific address and adapt the remaining lines too.

Related

Parsing Formula in Report Mail Settings

I'm trying to show an email pop up window with an attached report. I want the email fields in the popup window to be populated with the attached report's mail settings - similar to what happens when you click the "Send" button when running the report directly. I'm trying to do this in a PXAction method.
I've got it mostly done but, I'm having a problem if the Mail Settings have a formula in them. For instance if the Subject is set to "=[table].[field]" I get "=[table].[field]" in the Subject box for my email popup window instead of the value of table.field.
Any ideas on how to get the values of the Mail Settings fields in the report instead of the verbatim text?
TIA!
Here's what worked for me. I'm sure there's a way to dispense with the code that removes the "=" but, this got what I needed.
protected string GleanMailSetting(Report report, ReportNode reportNode, string settingText)
{
if ((string.IsNullOrEmpty(settingText)) || (!settingText.StartsWith("=")))
return settingText;
string trimmedText = settingText.TrimStart(new char[] { '=' });
PX.Common.Parser.ExpressionNode node = Reports.Parser.ReportExprParser.Parse(trimmedText, report);
node.Bind(report.DataSource);
return (string)node.Eval(reportNode.DataItem);
}

Lotus Notes - button automatic delete after running formula

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.
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.
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.)

Access field in a column in a Lotus Notes view

In Lotus Notes, I have view which has got a column say PolicyNum. Requirement is while double clicking on the document to open, which will open the attachment in the form in the view, it has to be validated against a computed field say SecureDoc which contains either Yes or No.
For client version this is easy as in the queryopen in the form it is validated and exited if the condition doesn't meet with proper messagebox.
But for the web version the column is appeared as a link and the messagebox has to appeared as alertbox in JS. In the PolicyNum column I have tried to use #GetField("SecureDoc") which will get the value of the field for that particular document.
Column Formula:
furl:="javascript:alert('Document not available');return false";
OpenDisp:="[" + PolicyNumber + "]";
secDoc:=#GetField("SecureDoc");
#If(att = "" ; OpenDoc ;secDoc="Yes";OpenDisp;OpenAttach)
Here OpenDoc and OpenAttach are different string which will open the document and attachment respectively depending on the att, which checks for the attachment.#GetField("SecureDoc") return "". So if I write #If(att = "" ; OpenDoc ;secDoc="";OpenDisp;OpenAttach) it is showing the alert box and is working fine.
So the requirement is to get the handle of the field value for the particular doc which is to be clicked on web and check for the condition.
Also webqueryopen is not working..
Note: On opening the document it is opening the attachment in the form and not the form itself.
Column Value :
view := "0";
att := #AttachmentNames;
WebName := #WebDbName ;
url := "'/" + WebName + "/" + view + "/" + #Text(#DocumentUniqueID) + "/$File/" + att + "?OpenElement'";
url := "window.open(" + url + ");" ;
url := #Implode(url; ";");
url := "javascript:" + url + " return false;\" href=\"javascript:void(0);";
furl:="javascript:alert('Document not available');return false";
OpenAttach := "[<TABLE><TR><TD NOWRAP><a target=_blank onClick=\"" + url + "\">" + PolicyNumber + "</a></TD></TR></TABLE>]";
OpenDoc := "[<TABLE><TR><TD NOWRAP>" + PolicyNumber + "</TD></TR></TABLE>]";
OpenDisp:="[<TABLE><TR><TD NOWRAP><a target=_blank onClick=\"" + furl + "\">" + PolicyNumber + "</a></TD></TR></TABLE>]";
secDoc:=#GetField("prevSecDoc");
#If(att = "" ; OpenDoc ;secDoc="Yes";OpenDisp;OpenAttach)
I have tried with both #If(att = "" ; OpenDoc ;secDoc="Yes";OpenDisp;OpenAttach) and #If(att = "" ; OpenDoc ;prevSecDoc="Yes";OpenDisp;OpenAttach) but it is not getting the value as "Yes". Though when I open the document through URL giving the docid it ha the value as "Yes"
Quick back to basics : a document is a record in a database, a form is, well, a form, which determines how data are input by the user and controls display.
Allow me to rephrase your question. If the document contains a field named "SecureDoc", and if said field holds the value "NO", then a click on the link must not open the document and present the user with a JavaScript alert.
One could question why display the document in the view in the first place, and then why have a link with no other effect than telling it has no effect.
OK, not my place to question the requirements.
My suggestion would be that the content of the column displayed for web access be a computed hyperlink :
href := #If( SecureDoc = "NO";
"javascript:alert('nope')";
"normal url for opening the doc"
);
"" + "the title of the doc or whatever" + ""

Send details to email on click of a button

I am developing an android app and i have a few edit texts and a submit button.
On click of the submit button all the fields in the edit texts entered by the user should be sent to a particular email id.
Could anyone please suggest me how it can be done?
String s = editText.getText().toString();
in button's onClickListner() method use this
Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:" + email));
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(Intent.EXTRA_TEXT, s);
//emailIntent.putExtra(Intent.EXTRA_HTML_TEXT, body); //If you are using HTML in your body text
startActivity(Intent.createChooser(emailIntent, "Send Email via"));
Already answered Here
As you are working with multiple editTexts you can do this,
String s = (editText1.getText().toString() + "\n" + editText2.getText().toString() + "\n"+editText3.getText().toString() + "\n" + editText4.getText().toString() + "\n" + editText5.getText().toString() + "\n" + editText6.getText().toString() + "\n");
and then use same snippet as above.
If you want to know how send email without prior user interaction then see this answer
see this code snippet here also : https://github.com/enrichman/androidmail
There is also an API available named mandrillapp:
Read this blog for full code : https://www.mindstick.com/Articles/1673/sending-mail-without-user-interaction-in-android

Gmail - Import to contacts link

When you go to Contacts >> More >> vCard format >> Export - this will create a contact file.
If you then compose a new message, attach that .vcf file, send to a Gmail address - Gmail will display a nice "Import to contacts" shortcut link to the recipient.
When you re-create the .vcf file in GAS in the same format as the exported file and send it as an attachment with GmailApp, Gmail does not show the "Import to contacts". It just shows "View".
However, if you click Download on the file created with GAS then attach and send in a new message composed manually, Gmail will show the Import link.
Is there anything Apps Script can do to ensure the "Import to contacts" link shows up when using GmailApp to send a vCard file as an attachment or is this really more of a Gmail issue?
var layout = 'BEGIN:VCARD' + '\n' +
'VERSION:3.0' + '\n' +
'FN: Forrest Gump' + '\n' +
'N:Gump;Forrest;;;' + '\n' +
'EMAIL;TYPE=INTERNET:forrestgump#example.com' + '\n' +
'END:VCARD' + '\n';
var vCard = [{fileName:"new contacts.vcf", content:layout}];
GmailApp.sendEmail("example#gmail.com", "Subject", "Body...", {attachments: vCard});
It's because you sent it as plain text. If you want Gmail to recognize it as vCard. You need to send it as octet-stream.
To fix this just put mimeType:"application/octet-stream" to your attach file description
e.g.
var vCard = [{fileName:"new contacts.vcf", content:layout, mimeType:"application/octet-stream"}];

Resources