• prhannon
  • 0 Points
  • Member since 2012

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 2

Hi Everyone,

I'm not a developer, so sorry if this is a little simple...I'm trying to create a button that can be clicked in a case record to send an email to the contact slotted in the case's Case ME field (custom Contact lookup field). The body of the email contains merge fields.

I'm not a developer, so am just guessing & testing my way through this (see code at bottom). I've run into a couple of roadblocks:

- I have put myself in the test record as Case ME. When I hit the button I don't get an error message, and the API call email comes in, but I do not receive an email.
- When I pull in the actual text I would like to use (vs. "test") I get an error message stating "unterminated string literal"

I've played around with this some with no success. Could anyone steer me in the right direction?


// single mail request
var singleRequest = new sforce.SingleEmailMessage();
singleRequest.replyTo = "support@journalexperts.com";
singleRequest.subject = "sent through ajax test driver";

singleRequest.plainTextBody = "this test went through ajax";
singleRequest.toAddresses = "{!Case.OwnerId}";

// mass mail request - need to get email template ID
var massRequest = new sforce.MassEmailMessage();
massRequest.targetObjectIds = ['0035000001N68EU'];
massRequest.replyTo = "support@journalexperts.com";
massRequest.subject = "sent through ajax test driver";

massRequest.plainTextBody = "*** NEW CASE ASSIGNMENT NOTIFICATION ***
The following case has been assigned to you.

Company: {!Organization.Name}
Contact Name: {!Contact.Name}
Case #: {!Case.Id} {!Case.CaseNumber}
Contact Email: {!Case.SuppliedEmail}

Submission ID: {!Case.Sub_ID__c}
Link to Submission: {!Case.Link_to_Sub__c}
Submission Type: {!Case.Type}

Subject: {!Case.Subject}
Description: {!Case.Description}

Click on the link to access the case: {!Case.Link}"


// send the email
var sendMailRes = sforce.connection.sendEmail([singleRequest, massRequest]);



I'm working through the tutorial here to enable a Customer Portal for my site:




As suggested, I got an existing account ID (I used my own account, which is an admin account) and pasted it into my SiteRegisterController, so it looks like this:


    public with sharing class SiteRegisterController


         private static Id PORTAL_ACCOUNT_ID = '00590000000aB8l'; // ID of my admin account


         // snip ...




But after I fill in all the details and hit siubmit on the self-registration page at /SiteRegister, I get:


  • Your request cannot be processed at this time. The site administrator has been alerted.
  • The account associated with this portal has no owner


The error email that gets sent to me when this occurs says:


    Catalog registration accountId parameter value is not valid 


How do I fix this? Feeling very lost in this system right now!



I am new to this so I assume this is a pretty simple question. I am trying to develop an e-mail alert that is sent when an Attachment is added to an Account. I am trying to get the Account name in the email. When I receive the email the subject just says: "Attachment Added: name". Attachment and Account are related through parentid, but I am having trouble returning account fields on an Attachment trigger. What am I doing wrong?  



trigger Send_email on Attachment (after insert) {
Attachment attach = trigger.new[0];
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'ja@example.com'};
mail.setSenderDisplayName('Salesforce Support');
mail.setSubject('Attachment Added : ' + account.name);
mail.setPlainTextBody('work please');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });