• Honey
  • 0 Points
  • Member since 2011

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
  • 12



I have written one email service through which I am attaching one xls file into record's attachment. I am able to read file if it is in .csv format but unable to read if it's in .xls format. Any idea how I can convert .xls to ,csv.


Thanks in advance.

  • August 10, 2013
  • Like
  • 0

Hi all,


I am looking for salesforce for quickbook integration API's. Please let me know if anyone having any idea to get api details.


Thanks in advance.

  • December 16, 2012
  • Like
  • 0



i have a issue in chatter, can we hide the first record from the chatter  were it shows ' USER NAME is created this Account '

and remaining updated thinks should display same as it is....,


is it possible to do..?






  • March 12, 2012
  • Like
  • 0


I have an object in my system with standard field Name. In this, I have 5 different record types. I need to change the label name for 5 different record types.

For e.g. There are A,B,C,D,E are 5 different record types and all is having name as standard field. I want to rename this field Label Name for C record type as Number.

Please suggest me how i can acheive that.

Thanks in Advance

  • February 23, 2012
  • Like
  • 0

I am using following template which will slecet by trigger, but when mail recieved thenfields that i want to show with relatedto type not come in mail.... please help me thanks in advance.......... all fields present in Event.


<messaging:emailTemplate subject="cbt" recipientType="User" relatedToType="Event">

<messaging:plainTextEmailBody >

{!$User.FirstName} {!$User.LastName}  committed to call  {!relatedTo.Contact_Name__c} at {!relatedTo.StartDateTime}.
This notification has been sent 15 minutes prior to the scheduled time.

The case can be accessed via the following link: https://cs4.salesforce.com/{!relatedTo.Case_Id__c}
Case Subject: {!relatedTo.Case_Subject__c}

Thank you,


  • August 05, 2011
  • Like
  • 0



I have written one email service through which I am attaching one xls file into record's attachment. I am able to read file if it is in .csv format but unable to read if it's in .xls format. Any idea how I can convert .xls to ,csv.


Thanks in advance.

  • August 10, 2013
  • Like
  • 0

What is the best way to disallow conversion of a lead if the ID of the logged in user is not the owner of the lead?


As the subject says, I just want the owner to be able to do this.


I have complicated insert triggers because I have assignment rules based on recordtypes, and I have lots of workflow rules that are changing all the time, that I'd rather not interfere with, if possible.


Thanks in advance


Note: I'm currently working on our staging site.


I added several new picklist values to a custom object, but not all of them are showing up on the object in the opportunity. I've checked to make sure that the object field matches the object field I'm looking at on the opportunity, so I'm not sure whats going on. Has anyone run into this before?



  • April 24, 2012
  • Like
  • 0

How to send an email without and with using e-mail template for a single and group of users in salesforce

  • September 28, 2011
  • Like
  • 0

My use case:

  • Sending demand letters to customers - single and mass
  • Custom objects: Payment_Schedule__c contains the amount to be paid/already paid amounts. Demand_Letter__c contains the body of the Demand Letter sent as well as its PDF attachment. Both are linked to Opportunity
  • User will send a Demand Letter by clicking on New button in Opportunity's related list - Single
  • User will send Demand Letter by selecting Opportunities and clicking Create Demand Letter button on Opportunity list view - Mass

Single sending works absolutely fine. Steps invlolved: 1. Create demand letter (name,Page1 content,Page2 content). 2. Save. 3. After saving on clicking Generate PDF button will display the contents - page1,page2 as well as pending payment in 3rd page. 4. If it looks fine, then send an email by attaching the pdf by clicking on Send Email button. DONE.


I am encountering problem with mass email. When there are more than 10 recipients(or Opportunities) selected, I receive System.LimitException: Too many Email Invocations: 11. Below is my code:


    public void sendAction() {
        try {
            showSendBtn = false;
            rtId = [select Id,name from RecordType where name='Demand Letter_After Sending' and SObjectType='Demand_Letter_Repository__c' limit 1].Id;
            if(! mass) {
                System.debug('### (DemandLetterEmailController) SINGLE. sendAction');
                dlObj.RecordTypeId = rtId;
                update dlObj;
            else {
                System.debug('### (DemandLetterEmailController) MASS. sendAction');
                System.debug('### (DemandLetterEmailController) lstDLR.size-inside sendAction: ' + lstDLR.size());
                //System.debug('### (DemandLetterEmailController) lstDLR-inside sendAction: ' + lstDLR);
                arrId.clear(); // arrId contains the opp ids. Hence clear all before re-using it for storing DLR's ids
                for(Demand_Letter_Repository__c dObj : lstDLR) {
                lstDLR = [select Name,Opportunity__c,Page1__c,Page2__c,To__c,
                    MassEmail__c,RecordTypeId from Demand_Letter_Repository__c 
                    where Id IN: arrId];
                System.debug('### (DemandLetterEmailController) after select.lstDLR.size-inside sendAction: ' + lstDLR.size());    
                for(Demand_Letter_Repository__c d : lstDLR) {
                    oId = String.valueOf(d.Opportunity__c).subString(0,15);
                    dId = String.valueOf(d.Id).subString(0,15);
                    //System.debug('### (DemandLetterEmailController) d-for loop: ' + d);
                    if(d.To__c !=null)
                        toAddresses = new String[]  { d.To__c } ;
                        toAddresses = null;
                    if(d.CC__c !=null) {
                        if(d.Opportunity__r.HFI__c !=null) {
                            System.debug('### (DemandLetterEmailController) inside d.Opportunity__r.HFI__c !=null');
                            if(d.Opportunity__r.HFI__r.Email__c != null) {
                                if(! d.CC__c.contains(d.Opportunity__r.HFI__r.Email__c)) {
                                    System.debug('### (DemandLetterEmailController)if ! d.CC__c.contains(d.Opportunity__r.HFI__r.Email__c)');
                                    d.CC__c = d.CC__c + ',' + d.Opportunity__r.HFI__r.Email__c;
                        ccAddresses = d.CC__c.split(',');
                        ccAddresses = null;
                    d.MassEmail__c = true;
                    d.RecordTypeId = rtId;
                update lstDLR;
            insert lstAtt;
            insert lstTask;
        catch(Exception e) {
            System.debug('### (DemandLetterEmailController) Exception-sendAction: ' + e.getMessage());
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,e.getMessage()));            
    private void sendAndAttach(Demand_Letter_Repository__c dlr) {
        mail = new Messaging.SingleEmailMessage();
        System.debug('### (DemandLetterEmailController) dlr: ' + dlr);
        System.debug('### (DemandLetterEmailController) dId: ' + dId);
        System.debug('### (DemandLetterEmailController) oId: ' + oId);
        pdf = new PageReference('/apex/DemandLetterPDF?id=' + dId + '&oppId=' + oId + '&type=old');
        System.debug('### (DemandLetterEmailController) pdf: ' + pdf);
        // Take the PDF content
        if(test)  // Just to skip if called from test method
            b = null;
            b = pdf.getContent();
        //Attach to Progress-**bleep**-Demand Letter Repository record
        lstAtt.add(new Attachment(parentId =dlr.Id,name=dlr.Name + '.pdf',body=b,OwnerId=dlr.OwnerId));
        System.debug('### (DemandLetterEmailController) lstAtt: ' + lstAtt);
        System.debug('### (DemandLetterEmailController) toAddresses: ' + toAddresses);
        if(toAddresses== null) {
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL,'Error while sending email - No TO address specified. *** A task has been created to take hard copy ***'));
            lstTask.add(new Task(Subject='Send Hard Copy',ActivityDate=System.Today(),Status='Not Started',
                                 WhatId=dlr.Id,Description='The customer does not have email specified. Send hard copy.',
                                 OwnerId = dlr.OwnerId,ReminderDateTime=System.Now(),IsReminderSet=true));
        // Create the email attachment  
        efa = new Messaging.EmailFileAttachment();
        //System.debug('### (DemandLetterEmailController) toAddresses: ' + toAddresses);
        mail.setPlainTextBody('Find attached demand letter.');
        mail.setHtmlBody('<div align="center"><h2><b>Demand Note</b></h2></div>'+
                     'Dear Sir/Madam,<br/><br/> Find attached demand letter.<br/><br/><br/>' +
                     'Regards,<br/>For Brigade Group.<br/>' +
                     'Date:' + String.valueOf(System.today()).subString(0,10));
        mail.setFileAttachments(new Messaging.EmailFileAttachment[] {efa});
        System.debug('### (DemandLetterEmailController) mail: ' + mail);
        r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});
        for(Messaging.sendEmailResult result : r) {
            if(result.isSuccess()) {
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM, 'Email Sent Successfully. To: ' + toAddresses + ' Cc: ' + ccAddresses));
                dlr.Sent_Date__c = System.Today();
                ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.FATAL, 'Error while sending email. To: ' + toAddresses + ' Cc: ' + ccAddresses));
        System.debug('### (DemandLetterEmailController) mail: ' + mail);


Any help would be appreciated.


I am having trouble using an email template. The error I get is: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_ID_FIELD, WhatId is not available for sending emails to UserIds.: [] 


Here is the code that I use to send the eamil:


Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            String[] toAddresses = new String[]{to};
            String[] bbcAddress = new String[]{bcc};
            if(attachlist != null){
            list<Messaging.Emailfileattachment> emailattachlist = new List<Messaging.Emailfileattachment>();
                for(Attachment a : attachlist){
                    Messaging.Emailfileattachment emailattach = new Messaging.Emailfileattachment();
            if(tempid == null){
            Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });


Hi All,

I want to get the name (API) of object (Custom or Standard) by Id. Is this possible, is there any method for it.


Please help me regarding this.

Thank you!




Hi All,


I have a question regarding consuming RSS feeds from Apex. I have a requirement where I need to get the data extracted from RSS feeds on Exchange rates and insert them in the Dated Exchange Rate table in salesforce and also to fixed exchange rate table.


I am aware that I need to write a Apex DOM class to read the feeds and apply the custom logic of matching out the diffrent currencies and upload in the relevent salesforce object for exchange rates. I am also aware that I need to get a subscription to the RSS feeds.


I faces problem in understanding how can I actully get the XML file and how to use or make a call to get the values using Apex class.


Please advice. Thanks a lot in advance for your responses.


Thanks and regards,