You need to sign in to do that
Don't have an account?
Erich.Weihrauch
Using an S-Control to send a prescribed email to a prescribed user?
Would it be possible to use the s-control to create a button that when
clicked, automatically sends an email to a prescribed user? This
control would also ideally be placed within a case, and when pressed,
it would send the prescribed user the initial case details (e.g.
initial case description). Is this possible? How do I do this? I'm a
bit new to scripting with S-Controls and such and the demos here on
Salesforce didn't quite do it for me.
Thanks!
Thanks!
<script src="/soap/ajax/9.0/connection.js" type="text/javascript"></script>
<script>
var user = sforce.connection.getUserInfo().userEmail;
//called to send email
var request = new sforce.SingleEmailMessage();
//create variable to hold addresses
var addr = new sforce.StringBuffer();
var subj = new sforce.StringBuffer();
var body = new sforce.StringBuffer();
//assign vaiables
addr = "me@here.com"
subj = "Important Notice: Case Out of the Ordinary Test";
body = "Testing";
//get variables
addr.append = addr;
request.replyTo = user;
request.subject = subj;
var sendMailRes = sforce.connection.sendEmail([request]);
</script>
While I'm somewhat familiar with Javascripting, I'm a little lost with the Sforce stuff..
Message Edited by Erich.Weihrauch on 02-14-2008 10:39 AM
Also, I was able to find a sample that may be able to assist you in more detail. The example they wrote uses a custom interface but ultimately sends an email using the API. Here is the sample: http://wiki.apexdevnet.com/index.php/Send_Emails_Through_SControls
I was actually working from that link you gave me, but guess I didn't quite get things right.
I've been trying to read up on the documentation but I guess being more of a non-coder...well I do php and mysql but not a lot of javascript and such..I'm having a tough time wrapping my head around it.
Also, what I don't quite understand, based off of what I read, is how do I implement the code? When developing a custom s-control what kind is it? URL, snippet, etc? When using that as a button in a case details layout I want to be able to just click a button and have the code executed and am having a tough time doing that as well.
Where the "000000000000000" portion of the click is the Id of your HTML sControl you created.
I've taken your code, and popped it into an HTML s-control, saved it, then went to the case section for customization, created a detail page button, linked it to an s-control and behavior is pop up in new window...
When I then click the button in a case, it pops up a window and all I see is..
<script type="text/javascript">function getRecordIds(keyPrefix) { return [] }</script><script type="text/javascript">__sfdcSessionId = '460700D700000008Bbn!ARQAQLtFKsPfCM4iQsDz0DFaS_y1.uA2YOopdsNNb2Rw.zIJVnokYqIX_lDGmWJgerwFg4FKEw.aIximDMXHXgx9cPMgCFFs'</script>var subjectHTML = "Test"; //create the header portion of the HTML message var emailBody = ""; emailBody += ""; emailBody += " "; emailBody += ""; emailBody += ""; emailBody += ""; emailBody += "
Hello,
"; emailBody += "This is a test message...
"; emailBody += "Thanks for reading.
"; emailBody += "Written by,
"; emailBody += "Greg H
I'm not sure what I'm doing wrong..do I need to wrap the code in html or declare it as a javascript?
How to attach a file with email while using AJAX API ? can you post that piece of code plz ?
Does this work for file attachments as well? as the code given seems to work fine as long as it is documents but when the Attachment id is used there is no attachment in the mail.