• KD123456
  • NEWBIE
  • 25 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 10
    Replies

Hi,

 

I have a trigger that sends notifications to a specific gmail id  whenever a email message is received in a case or sent from the case. I have a used a fixed template for setting the Subject for these notification emails such that they form a conversation thread for each case in the gmail account. This has been working correctly untill now when we received an email that had special caracters in the subject line.

 

The scenario is a customer sent an email with some foriegn characters in the subject line, this email created the case and the case subject also has these foriegn characters in them. The email message triggers the notification email. Upon receiving the notification our support person replied to the customer from the case. This email also triggered the notification. But both these email have come in as seperate threads instead of one.

 

The code that I use for setting the subject line is as follows

mail.setSubject('SR ' + listC[0].CaseNumber + ' [' +listC[0].Subject+ ']');

In gmail using the "Show Original" feature I could see the Subject line of the notification sent in a proper scenario where they are threading properly

Subject: SR 04113 [LAG hashing issues]

In gmail using the "Show Original" feature the Subject line for the notification with special charcters are as follows

this is when the notification was sent for the customer's email

Subject: =?ISO-8859-1?Q?SR_04116_[Re:_=3FSFG=3FSSH,Telnet]?=

this is when the notification was sent for the support persons email

Subject: =?UTF-8?Q?SR_04116_[Re:_=E3=80=90SFG=E3=80=91SSH,Telnet]?=

 

Please help me in understanding why would there by 2 types of subject line when the code that sends the email notification is common. How do I fix this so that it does not create new threads?

 

Thanks

KD



Hi,

 

We are creating a simple App, there are no Visualforce pages involved in the App. In the Salesforce standard UI how do I enable Inline Editing for Related List.

I have enable Inline Edit option from Setup-Customize-User Interface, but that does not allow me to make inline edit for Related lists. The field types that are to be editted or Text and Picklist.

Any help on this would be great.

 

Thanks

KD

Hi,

 

We have a App listed in AppExchange, we have building one more that uses few functionalities of the first App. My questions are

 

  1. Can we have more than 1 Managed App in one developer environment?
  2. If No, is it possible to use the Codes and setting on a new developer environment (there will a need to edit them)?
Thanks
KD

 

The requirement is

 

  1. Send notification emails to a particular email address whenever there is an email activity in a case. The notification should contain the email body.
  2. The notification emails should contain the attachments that were part of the email that triggered the notification.
  3. The notification emails of case should form a conversation thread in gmail (the specified email address is gmail)

 

I am able to complete the first 2 requirements, but the 3rd one is causing troubles. It works partially though. With all that I have heard Gmail uses the Subject line to group emails into a conversation thread. I have a constant Subject but still the notification emails create new conversation threads for each new day.

 

Example

Day 1 – there are 8 email activities in the case 1 and there are 2 email activities in case 2. The apex code sends 8 notifications related to case 1 that form a conversation thread and 2 notifications for case 2 that form another conversation thread. (this is correct)

Day 2 – there are 3 email activities in case 1 and there are 4 email activities in case 2. The apex code sends 3 notifications related to case 1 but this forms a new conversation thread and is not part of the same conversation thread created on day 1.

 

How can I form a single thread for each case instead of single thread of each case on each day?

 

I tried using the setInReplyTo and setReferences but got errors and the notification was not sent. Will this help in the threading problem, what are the other options?

 

Thanks

KD

 

Hi,

 

I am trying to find more information on Force.com on the following areas, any help or direction is very much appreciated.

  1. Is there any limit on the number of pages that I can have in my website created using force.com free edition? If yes what are the limits.
  2. Are there any restrictions in accessing standard or custom objects when creating sites in the forc.com free edition? If yes what kind of restrictions are there?
  3. Can we easily scale from force.com free editions to either the enterprise edition or unlimited edition without having to tweak the website? Will this automatically scale the limit on the number of users?
  4. How much data or files can be stored for the Organization? Will the images and other contents used to develop the website be part of the storage limit?

 

Thanks

KD

 

Hi,

 

I am trying to use the setInReplyTo option in single email message to solve a conversation threading problem. I am querying for an emailmessage and then setting that Id as value for the method. I am encountering run time errors with this

 

System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_MESSAGE_ID_REFERENCE, In-Reply-To header is not valid.: []

 

I am not sure how to set this up to work. Please help.

 

Thanks

KD

Hi,

 

I have enabled Email to case and have tried to write an after insert trigger that will allow me to send a notification email to the case owner with any of the attachments that the case came with but the trigger failed in execution because the case was not created and thus i was not able to select the attachment for that case.

 

I then tried to use the email services and code the email to case functionality, i first insert the details in Case object and after the insert statement try to use the Owner Id and I find out not matter what the Id is not populated and the record does not get created.

 

Any help in showing how the case is created and what are the sequence of items that goes into the transaction of creating a case.

 

Thanks

KD

Hi,

 

I am trying to send a notification email whenever a case is created with the attachments that were included in the email which created the case. I am able to get the code developed and it sends the notification email but the attachment is not getting through please help

trigger EmailNotification on Case (after insert, after update) {
    for(Case c : system.Trigger.New) {
//        if(c.Notified__c == true) {
            List<EmailTemplate> listET = new List<EmailTemplate>();
            List<User> listOwner = new List<User>();
            List<Attachment> listAttch = new List<Attachment>();
            listET = [select Id, Name, Body, Subject from EmailTemplate where Name = 'Support: Case Assignment Notification'];
            listOwner = [select Id, Name, Email from User where Id = : c.OwnerId];
            listAttch = [select Id, Name, Body, ParentId, ContentType from Attachment where ParentId = : c.Id];
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            Messaging.EmailFileAttachment emailAttch = new Messaging.EmailFileAttachment();
            if(listAttch.size() > 0) {
                for(integer i = 0; i < listattch.size(); i++) {
                    emailAttch.setFileName(listAttch[i].Name);
                    emailAttch.setBody(listAttch[i].Body);
                    emailAttch.setContentType(listAttch[i].ContentType);
                }
                mail.setFileAttachments(new Messaging.EmailFileAttachment[] {emailAttch});
            }
            string[] toadresses;
            for(integer j = 0; j < listOwner.size(); j++) {
                toadresses = new string[] {listOwner[j].Email};
            }
            mail.setToAddresses(toadresses);
            mail.setReplyTo('spprtemail5@gmail.com');
            mail.setSenderDisplayName('SupportEmail');
            for(integer k = 0; k < listET.size(); k++) {
                mail.setSubject(listET[k].Subject);
                mail.setHtmlBody(listET[k].Body);
            }
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
//        }
    }
}

 

 

Hi,

 

I have created a workflow on case object that would update a field based on the time trigger. The least time that I could setup was 1 hour. I would like to set it up such that it executes within 5 minutes and 1 hour. How do I get this done?

 

Thanks

KD

Hi,

 

I am unable to find what is going wrong....

any help provided is highly appriciated

I am trying to get an attachment from a case and send it through the notification email and have been failing at each attempt.

After Insert triggers in case does not work, it seems to execute even before the records are saved. This is the last thing I am trying now

 

public with Sharing class notifyEmail {
    Casetracker__c objectCT;
    Case objectC;
    Attachment objectA;
    User objectU;
    List<Casetracker__c> listCT = new List<Casetracker__c>();
    List<Case> listC = new List<Case>();
    List<Attachment> listA = new List<Attachment>();
    List<User> listU = new List<User>();
    List<EmailTemplate> listET = new List<EmailTemplate>();
    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    Messaging.EmailFileAttachment ea = new Messaging.EmailFileAttachment();
    listCT = [select Id, Casenumber__c from Casetracker__c where Id = 'a0090000001PMKpAAO'];
    listC = [select Id, OwnerId from Case where CaseNumber = : listCT.Casenumber__c];
    listU = [select Id, Email from User where Id = : listC.OwnerId];
    listA = [select Id, Name, Body, ContentType from Attachment where ParentId = : listC.Id];
    listET = [select Id, Name, Body, Subject from EmailTemplate where Name = 'Support: Case Assignment Notification'];
    if(listA.size()> 0) {
        ea.setFileName(listA.Name);
        ea.setContentType(listA.ContentType):
        ea.setBody(listA.Body);
        ea.setInLine(false);
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] {ea});
    }
    string[] toadd = new string[] {listU.Email};
    mail.setToAddresses(toadd);
    mail.setReplyTo('spprtemail5@gmail.com');
    mail.setSenderDisplayName('SupportEmail');
    mail.setSubject(listET.Subject);
    mail.setHtmlBody(listET.Body);
    Messaging.sendEmail(new Messagin.SingleEmailMessage[] {mail});
}

 Please tell me why I get the above error.

 

 

Thanks

KD

Hi,

 

We have enabled email to case service. It works fine, the case is created and the notification emails are sent to the appropriate mailing groups properly. The emails sent by our customer will have attachments. As of now the attachments are created and I can view them in the Attachments related list. I am trying to make the attachments part of the notification email but am not able to get it done.

trigger notificationEmail on Case (after insert) {
    for(Case c : system.Trigger.new) {
        EmailTemplate template = new EmailTemplate();
        EmailMessage email = new EmailMessage();
        User owner = new User();
        Attachment attch = new Attachment();
        template = [select Id, Name, Body, Subject from EmailTemplate where Name = 'Support: Case Assignment Notification'];
        owner = [select Id, Name, Email from User where Id = : c.OwnerId];
        system.debug('the case id is' + c.Id);
        email = [select Id from EmailMessage where ParentId = : c.Id];
        attch = [select Id, Name, Body, ParentId, ContentType from Attachment where ParentId = : email.Id];
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        if (attch.size() > 0) {
            Messaging.EmailFileAttachment emailAttch = new Messaging.EmailFileAttachment();
            emailAttch.setFileName(attch.Name);
            emailAttch.setBody(attch.Body);
            emailAttch.setContentType(attch.ContentType);
            emailAttch.setInline(false);
            mail.setFileAttachments(new Messaging.EmailFileAttachment[] {emailAttch});
        }
        string[] toadresses = new string[] {owner.Email};
        mail.setToAddresses(toadresses);
        mail.setReplyTo('spprtemail5@gmail.com');
        mail.setSenderDisplayName('SupportEmail');
        mail.setSubject(template.Subject);
        mail.setHtmlBody(template.Body);
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
    }
}

 This code fails to retrieve information from the attachment or the Email message object for the given case Id and the case also fails to be created what is going wrong. How can this be fixed.

 

Thanks

KD

 

Hi,

 

I have used a trigger within SFDC to check for duplicates leads. The leads are generated using the web to lead form included in our companies website. I would like to show the Message from the trigger in the website when a duplicate lead is being entered, what should be done.

 

Thanks

KD

Hi,

 

I am trying to automate the process of converting the leads as contacts.

I have used the web to lead form to create the leads in SFDC from our website. The leads are also saved in the local database

We then login into the website and then check for the new leads and try to approve them. On approving the leads in the website the same lead in SFDC should be converted as contact.

 

I tried the sample provided for convertLead(). I am not sure how to use this correctly as it keeps popping with errors. Please let me know if there is something I have to do in SFDC apex, what are the WSDL that I should use for reference.

 

Thanks

KD

The requirement is

 

  1. Send notification emails to a particular email address whenever there is an email activity in a case. The notification should contain the email body.
  2. The notification emails should contain the attachments that were part of the email that triggered the notification.
  3. The notification emails of case should form a conversation thread in gmail (the specified email address is gmail)

 

I am able to complete the first 2 requirements, but the 3rd one is causing troubles. It works partially though. With all that I have heard Gmail uses the Subject line to group emails into a conversation thread. I have a constant Subject but still the notification emails create new conversation threads for each new day.

 

Example

Day 1 – there are 8 email activities in the case 1 and there are 2 email activities in case 2. The apex code sends 8 notifications related to case 1 that form a conversation thread and 2 notifications for case 2 that form another conversation thread. (this is correct)

Day 2 – there are 3 email activities in case 1 and there are 4 email activities in case 2. The apex code sends 3 notifications related to case 1 but this forms a new conversation thread and is not part of the same conversation thread created on day 1.

 

How can I form a single thread for each case instead of single thread of each case on each day?

 

I tried using the setInReplyTo and setReferences but got errors and the notification was not sent. Will this help in the threading problem, what are the other options?

 

Thanks

KD

 

Hi All,

 

Inside an Opportunity i have a custom object "opportunity_proposals__c", as i click on the 'New Opportunity Proposal' button in the related list, a new page of Opportunity Proposal gets opened to create a new record.... i want the 'Opportunity Proposal name' field should gets prepopulated with an Opportunity name....

 

i have written a trigger for this...

 

trigger ProposalName on opportunity_proposals__c (before insert)
{

for(opportunity_proposals__c a:Trigger.new)       
{
String Prop = 'Proposal';
a.Name = a.Opportunity__c + Prop ;
}


}

 

I need to prepopulate the Name field with the Opportunity Name.. while creating the new record....

 

i hope i have explained the requirement.. pls let me know if anything else is required....

 

Thanks

I am an implementation consultant. A lot of my clients use the same custom fields because they are in the same vertical, is there a way for me to create an app or empty org with the custom fields and then download the fields into my clients org? I am getting tired of creating the same fields over and over again.

  • December 16, 2010
  • Like
  • 0

Hello,

 

I was wondering if it was possible to create a custom tab whereby the user picks their name from a picklist and then a field on the bottom of the picklist will auto generate their email.

 

The way i see it in my head right now is this: have the email field get its value from a user profile. but i am not sure if this will work with a picklist.

 

Thank you.

Hi,

 

I have enabled Email to case and have tried to write an after insert trigger that will allow me to send a notification email to the case owner with any of the attachments that the case came with but the trigger failed in execution because the case was not created and thus i was not able to select the attachment for that case.

 

I then tried to use the email services and code the email to case functionality, i first insert the details in Case object and after the insert statement try to use the Owner Id and I find out not matter what the Id is not populated and the record does not get created.

 

Any help in showing how the case is created and what are the sequence of items that goes into the transaction of creating a case.

 

Thanks

KD

Hi,

 

I am trying to send a notification email whenever a case is created with the attachments that were included in the email which created the case. I am able to get the code developed and it sends the notification email but the attachment is not getting through please help

trigger EmailNotification on Case (after insert, after update) {
    for(Case c : system.Trigger.New) {
//        if(c.Notified__c == true) {
            List<EmailTemplate> listET = new List<EmailTemplate>();
            List<User> listOwner = new List<User>();
            List<Attachment> listAttch = new List<Attachment>();
            listET = [select Id, Name, Body, Subject from EmailTemplate where Name = 'Support: Case Assignment Notification'];
            listOwner = [select Id, Name, Email from User where Id = : c.OwnerId];
            listAttch = [select Id, Name, Body, ParentId, ContentType from Attachment where ParentId = : c.Id];
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            Messaging.EmailFileAttachment emailAttch = new Messaging.EmailFileAttachment();
            if(listAttch.size() > 0) {
                for(integer i = 0; i < listattch.size(); i++) {
                    emailAttch.setFileName(listAttch[i].Name);
                    emailAttch.setBody(listAttch[i].Body);
                    emailAttch.setContentType(listAttch[i].ContentType);
                }
                mail.setFileAttachments(new Messaging.EmailFileAttachment[] {emailAttch});
            }
            string[] toadresses;
            for(integer j = 0; j < listOwner.size(); j++) {
                toadresses = new string[] {listOwner[j].Email};
            }
            mail.setToAddresses(toadresses);
            mail.setReplyTo('spprtemail5@gmail.com');
            mail.setSenderDisplayName('SupportEmail');
            for(integer k = 0; k < listET.size(); k++) {
                mail.setSubject(listET[k].Subject);
                mail.setHtmlBody(listET[k].Body);
            }
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
//        }
    }
}

 

 

Hi there, I have a workflow rule that sends email to a contact. I'd love it if this activity was then logged on the contact record so that there would be a record of the email being sent. Is there any way to configure that in setup somewhere, or would this require Apex code? Thanks!

Hi,

 

I have created a workflow on case object that would update a field based on the time trigger. The least time that I could setup was 1 hour. I would like to set it up such that it executes within 5 minutes and 1 hour. How do I get this done?

 

Thanks

KD

Hi,

 

I am unable to find what is going wrong....

any help provided is highly appriciated

I am trying to get an attachment from a case and send it through the notification email and have been failing at each attempt.

After Insert triggers in case does not work, it seems to execute even before the records are saved. This is the last thing I am trying now

 

public with Sharing class notifyEmail {
    Casetracker__c objectCT;
    Case objectC;
    Attachment objectA;
    User objectU;
    List<Casetracker__c> listCT = new List<Casetracker__c>();
    List<Case> listC = new List<Case>();
    List<Attachment> listA = new List<Attachment>();
    List<User> listU = new List<User>();
    List<EmailTemplate> listET = new List<EmailTemplate>();
    Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    Messaging.EmailFileAttachment ea = new Messaging.EmailFileAttachment();
    listCT = [select Id, Casenumber__c from Casetracker__c where Id = 'a0090000001PMKpAAO'];
    listC = [select Id, OwnerId from Case where CaseNumber = : listCT.Casenumber__c];
    listU = [select Id, Email from User where Id = : listC.OwnerId];
    listA = [select Id, Name, Body, ContentType from Attachment where ParentId = : listC.Id];
    listET = [select Id, Name, Body, Subject from EmailTemplate where Name = 'Support: Case Assignment Notification'];
    if(listA.size()> 0) {
        ea.setFileName(listA.Name);
        ea.setContentType(listA.ContentType):
        ea.setBody(listA.Body);
        ea.setInLine(false);
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] {ea});
    }
    string[] toadd = new string[] {listU.Email};
    mail.setToAddresses(toadd);
    mail.setReplyTo('spprtemail5@gmail.com');
    mail.setSenderDisplayName('SupportEmail');
    mail.setSubject(listET.Subject);
    mail.setHtmlBody(listET.Body);
    Messaging.sendEmail(new Messagin.SingleEmailMessage[] {mail});
}

 Please tell me why I get the above error.

 

 

Thanks

KD