• khanWebguru
  • NEWBIE
  • 49 Points
  • Member since 2009

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 21
    Replies
For some reason, whenever I use a record ID within a custom link or button, Salesforce is passing in the 15-character ID instead of the 18-character ID. In the past, I have coded around this on my own (using case-sensitive comparisons and substrings) but I'm now running into an issue where it's not possible to use these tricks.

Why is SF only passing the 15-character ID and how do I make it use the 18-character ID?

Thanks,
Mike
I am having trouble sending email using MassEmailMessage. At this point I am only sending a single email to one contact, but MassEmailMessage seems to be the only way to programmatically send an email using an existing template.

I'm using the code below in an s-control attached to a button on the Contact form, and everything seems to run fine. The alert() pops up a message that says {success:'true',}, and the resulting page says Email sent! as shown in the code. If I look at Setup | Monitoring | Mass Email Monitoring, the send is shown there as successful. But the email never arrives. (For testing, I'm sending it to myself. No, it's not in my spam filter.)

I am able to use SingleEmailMessage with no problem.

What am I doing wrong? Thanks for any pointers!

Don

Code:
<html>
   <head>
   <script src="/soap/ajax/10.0/connection.js" type="text/javascript"></script>
   <script>
      var contactId = "{!Contact.Id}";
      function sendEmail() {
            var result = "";
            try {
                        var templResp = sforce.connection.query("select id from emailtemplate where name = 'Welcome!'");
                        var templateID = templResp.getArray("records")[0].Id;
                        var mass = new sforce.MassEmailMessage();
            
                        mass.replyTo = "donkiely@computer.org";
                        mass.subject = "Mass Email from SF!";
                        var a = new Array(1);
                        a[0] = contactId;
                        mass.targetObjectIds = a;
                        mass.saveAsActivity = true;
                        mass.templateId = templateID;
                        var sendMailRes = sforce.connection.sendEmail([mass]);
                        
                        alert(sendMailRes);

                     output.innerHTML = "Email sent! " + "result: " + result;
            } catch(error) {
                        output.innerHTML = error + ":result = " + result;
            }
      }
   </script>
   <body onload="sendEmail()">
      <div id="output"></div>
   </body>
</html>

Message Edited by RiverChaser on 09-09-2007 12:30 PM

I am trying to make customer portal but I am stuck on my way :(. I selected Customer Portal and created a new portal having name as "My Customer Portal" after that I explore the option and found some options under "Look and Feel section" when I hit search icon infront of header text box that shows me a popup which is total empty and there is an option for search. I am not getting the exact place where should I define that header so that it can be list down in that popup whcih allow me to select and set in Header text box. I did 2 things.



1: I uploaded my logo in static folder and some css.

2: I created a component having some HTML.



But again these two things are not listing in header findings.



Please anyone help me in this situation. Where should I define some HTML so That it will show in header and footer search dialoge for selection and also logo???



Please help me I am thanking you in advance.



BR,



Asif Ahmed Khan

Sr. Software Enginner

Palmchip Pvt. Ltd


I am trying to make customer portal but I am stuck on my way :(. I selected Customer Portal and created a new portal having name as "My Customer Portal" after that I explore the option and found some options under "Look and Feel section" when I hit search icon infront of header text box that shows me a popup which is total empty and there is an option for search. I am not getting the exact place where should I define that header so that it can be list down in that popup whcih allow me to select and set in Header text box. I did 2 things.

 

1: I uploaded my logo in static folder and some css.

2: I created a component having some HTML.

 

But again these two things are not listing in header findings.

 

Please anyone help me in this situation. Where should I define some HTML so That it will show in header and footer search dialoge for selection and also logo???

 

Please help me I am thanking you in advance.

 

BR,

 

Asif Ahmed Khan

Sr. Software Enginner

Palmchip Pvt. Ltd

 

Dear All,

 

 I have an email template which is given below:

 

Evaluation Request from {!Lead.LastName} {!Lead.FirstName} for {!Lead.SupportProduct__c}, is pending and requires manual approval. <br/>

Click <a href="{!ApprovalRequest.Internal_URL}">here</a> to approve or reject this request.<br/><br/>

Thanks.

 

Whenever I use this template through "Approval Processes" it works fine. But I have different situation in which I cannot use "Approval Processes". For example I need that when a Lead create then email should be generate for Lead Approval and send to those receptionist that are belongs to selected region. If a lead belongs to ASIA then email should be send on asia@abc.com or if region is USA then it should be for usa@abc.com I successfully completd this task with static or just text base template. But whenever I use Customise template its not filling merge values. Following is TRIGER code:

 

trigger TestEmail on Lead (after insert)
{       
            MailerUtils.sendMail(Trigger.new[0].Region__c, String.valueOf(Trigger.new[0].Id), Trigger.new  [0].IsEmbargoe__c);


 

 

Now, following is MailerUtils class having sendMail method

 

public class MailerUtils
{
 
    public static void sendMail(string location, string leadId, Boolean IsEmbargoe)
    {
        string message;
        string temp = 'ApproveLeadTemplate';
        String[] toAddresses;
        List<Id> idsList = getEmailAddresses(location);
       
        if(IsEmbargoe == False)
        {
            temp = 'ApproveEmbargoeTemplate';
        }
        EmailTemplate e = [select Id,Name,Subject,body from EmailTemplate where name like :temp+'%'];
                                                  
        if(e != null || idsList==null)
        {
            Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
            mail.saveAsActivity = false;
   
            mail.setTargetObjectIds(idsList);
            mail.setTemplateId(e.Id);
           
            mail.setUseSignature(false);
            mail.setSaveAsActivity(false);


            // Send the email
            Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });
          
        }
        else
        {
            Messaging.SingleEmailMessage mail1 = new Messaging.SingleEmailMessage();
            toAddresses = new String[] {'khan@abc.com'};
            mail1.setToAddresses(toAddresses);
            message = 'This email will recieve by you only if Template Not Found!!!';
            mail1.setHtmlBody(message);
        }
                
            }  
   
     public static List<Id> getEmailAddresses(string groupName)
     {

        List<String> idList = new List<String>();
       
        List<Id> mailToIds = new List<Id>();
       
        Group g = [SELECT (select userOrGroupId from groupMembers) FROM group WHERE name = :groupName];
       
        for (GroupMember gm : g.groupMembers) {
       
        idList.add(gm.userOrGroupId);
       
        }
       
        User[] usr = [SELECT Id, email FROM user WHERE id IN :idList];
       
        for(User u : usr) {
       
        mailToIds.add(u.Id);
       
        }
       
        return mailToIds;
       
    }
   

 

 

I have some public group having same name like ASIA, USA and Austrailia so that this help me to pull autmatic all user from selected group on the bases of Region.

 

But In all this I am having problem that the dynamic fields or u can say merge fields are not filling please help me in this context. Thanking in advance for you help.

 

Regards,

 

Asif Ahmed Khan

Sr. Software Eng.

Palmchip :)

Dear All,

 

 I have an email template which is given below:

 

Evaluation Request from {!Lead.LastName} {!Lead.FirstName} for {!Lead.SupportProduct__c}, is pending and requires manual approval. <br/>

Click <a href="{!ApprovalRequest.Internal_URL}">here</a> to approve or reject this request.<br/><br/>

Thanks.

 

Whenever I use this template through "Approval Processes" it works fine. But I have different situation in which I cannot use "Approval Processes". For example I need that when a Lead create then email should be generate for Lead Approval and send to those receptionist that are belongs to selected region. If a lead belongs to ASIA then email should be send on asia@abc.com or if region is USA then it should be for usa@abc.com I successfully completd this task with static or just text base template. But whenever I use Customise template its not filling merge values. Following is TRIGER code:

 

trigger TestEmail on Lead (after insert)
{       
            MailerUtils.sendMail(Trigger.new[0].Region__c, String.valueOf(Trigger.new[0].Id), Trigger.new  [0].IsEmbargoe__c);


 

 

Now, following is MailerUtils class having sendMail method

 

public class MailerUtils
{
 
    public static void sendMail(string location, string leadId, Boolean IsEmbargoe)
    {
        string message;
        string temp = 'ApproveLeadTemplate';
        String[] toAddresses;
        List<Id> idsList = getEmailAddresses(location);
       
        if(IsEmbargoe == False)
        {
            temp = 'ApproveEmbargoeTemplate';
        }
        EmailTemplate e = [select Id,Name,Subject,body from EmailTemplate where name like :temp+'%'];
                                                  
        if(e != null || idsList==null)
        {
            Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
            mail.saveAsActivity = false;
   
            mail.setTargetObjectIds(idsList);
            mail.setTemplateId(e.Id);
           
            mail.setUseSignature(false);
            mail.setSaveAsActivity(false);


            // Send the email
            Messaging.sendEmail(new Messaging.MassEmailMessage[] { mail });
          
        }
        else
        {
            Messaging.SingleEmailMessage mail1 = new Messaging.SingleEmailMessage();
            toAddresses = new String[] {'khan@abc.com'};
            mail1.setToAddresses(toAddresses);
            message = 'This email will recieve by you only if Template Not Found!!!';
            mail1.setHtmlBody(message);
        }
                
            }  
   
     public static List<Id> getEmailAddresses(string groupName)
     {

        List<String> idList = new List<String>();
       
        List<Id> mailToIds = new List<Id>();
       
        Group g = [SELECT (select userOrGroupId from groupMembers) FROM group WHERE name = :groupName];
       
        for (GroupMember gm : g.groupMembers) {
       
        idList.add(gm.userOrGroupId);
       
        }
       
        User[] usr = [SELECT Id, email FROM user WHERE id IN :idList];
       
        for(User u : usr) {
       
        mailToIds.add(u.Id);
       
        }
       
        return mailToIds;
       
    }
   

 

 

I have some public group having same name like ASIA, USA and Austrailia so that this help me to pull autmatic all user from selected group on the bases of Region.

 

But In all this I am having problem that the dynamic fields or u can say merge fields are not filling please help me in this context. Thanking in advance for you help.

 

Regards,

 

Asif Ahmed Khan

Sr. Software Eng.

Palmchip :)

 

I have Product object in salesforce and there are some products like 'MQX', 'ARC 600' etc

 

I am trying to get records through LIKE query like:

 

results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);

 

When I set filterby variable to "MQX" its not returning records :smileysad:... When I tried tro get records for "ARC"also givinig me NULL but when I ask for "600" then its returning fine also when I requested " MQX"  mean with one space as prefix also getting result but not getting exact match but getting like "Prodcut of MQX" etc......please have a look on following code

 

private void BindData(Integer newPageIndex)
    {
        try
        {
                string sortFullExp = sortExpression  + ' ' + sortDirection;
                searchText=sortFullExp;
                if(filterby == null || filterby == '')
                {                    
                      //searchText='Coming';
                }
                else if(filterby != '')    
                {
                       
                        results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);
                      
                      
                    
                }                         
    
            pageResults = new List<Product2>();
            Transient Integer counter = 0;
            Transient Integer min = 0;
            Transient Integer max = 0;
            if (newPageIndex > pageNumber)
            {
                min = pageNumber * pageSize;
                max = newPageIndex * pageSize;
            }
            else
            {
                max = newPageIndex * pageSize;
                min = max - pageSize;
                //min = (min <>
            }
            for(Product2 a : results)
            {    
                counter++;
                if (counter > min && counter <= max)
                    pageResults.add(a);
            }
            pageNumber = newPageIndex;
            if (pageResults == null || pageResults.size() <= 0)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'Data not available for this view.'));
               results=null;
               pageResults=null;
            }
        }
        catch(Exception ex)
        {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,ex.getMessage()));
        }
    }

 

I have 7000 products in my object. Please help me in this. I want to get actual records for LIKE query.. Please reply ASAP Thanks in advance.

I have Product object in salesforce and there are some products like 'MQX', 'ARC 600' etc

 

I am trying to get records through LIKE query like:

 

results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);

 

When I set filterby variable to "MQX" its not returning records :smileysad:... When I tried tro get records for "ARC"also givinig me NULL but when I ask for "600" then its returning fine also when I requested " MQX"  mean with one space as prefix also getting result but not getting exact match but getting like "Prodcut of MQX" etc......please have a look on following code

 

private void BindData(Integer newPageIndex)
    {
        try
        {
                string sortFullExp = sortExpression  + ' ' + sortDirection;
                searchText=sortFullExp;
                if(filterby == null || filterby == '')
                {                    
                      //searchText='Coming';
                }
                else if(filterby != '')    
                {
                       
                        results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);
                      
                      
                    
                }                         
    
            pageResults = new List<Product2>();
            Transient Integer counter = 0;
            Transient Integer min = 0;
            Transient Integer max = 0;
            if (newPageIndex > pageNumber)
            {
                min = pageNumber * pageSize;
                max = newPageIndex * pageSize;
            }
            else
            {
                max = newPageIndex * pageSize;
                min = max - pageSize;
                //min = (min <>
            }
            for(Product2 a : results)
            {    
                counter++;
                if (counter > min && counter <= max)
                    pageResults.add(a);
            }
            pageNumber = newPageIndex;
            if (pageResults == null || pageResults.size() <= 0)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'Data not available for this view.'));
               results=null;
               pageResults=null;
            }
        }
        catch(Exception ex)
        {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,ex.getMessage()));
        }
    }

 

I have 7000 products in my object. Please help me in this. I want to get actual records for LIKE query.. Please reply ASAP Thanks in advance.

I have Product object in salesforce and there are some products like 'MQX', 'ARC 600' etc

 

I am trying to get records through LIKE query like:

 

results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);

 

When I set filterby variable to "MQX" its not returning records :(... When I tried tro get records for "ARC"also givinig me NULL but when I ask for "600" then its returning fine also when I requested " MQX"  mean with one space as prefix also getting result but not getting exact match but getting like "Prodcut of MQX" etc......please have a look on following code

 

private void BindData(Integer newPageIndex)
    {
        try
        {
                string sortFullExp = sortExpression  + ' ' + sortDirection;
                searchText=sortFullExp;
                if(filterby == null || filterby == '')
                {                    
                      //searchText='Coming';
                }
                else if(filterby != '')    
                {
                       
                        results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);
                      
                      
                    
                }                         
    
            pageResults = new List<Product2>();
            Transient Integer counter = 0;
            Transient Integer min = 0;
            Transient Integer max = 0;
            if (newPageIndex > pageNumber)
            {
                min = pageNumber * pageSize;
                max = newPageIndex * pageSize;
            }
            else
            {
                max = newPageIndex * pageSize;
                min = max - pageSize;
                //min = (min <>
            }
            for(Product2 a : results)
            {    
                counter++;
                if (counter > min && counter <= max)
                    pageResults.add(a);
            }
            pageNumber = newPageIndex;
            if (pageResults == null || pageResults.size() <= 0)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'Data not available for this view.'));
               results=null;
               pageResults=null;
            }
        }
        catch(Exception ex)
        {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,ex.getMessage()));
        }
    }

 

I have 7000 products in my object. Please help me in this. I want to get actual records for LIKE query.. Please reply ASAP Thanks in advance.

 

I am trying to make customer portal but I am stuck on my way :(. I selected Customer Portal and created a new portal having name as "My Customer Portal" after that I explore the option and found some options under "Look and Feel section" when I hit search icon infront of header text box that shows me a popup which is total empty and there is an option for search. I am not getting the exact place where should I define that header so that it can be list down in that popup whcih allow me to select and set in Header text box. I did 2 things.



1: I uploaded my logo in static folder and some css.

2: I created a component having some HTML.



But again these two things are not listing in header findings.



Please anyone help me in this situation. Where should I define some HTML so That it will show in header and footer search dialoge for selection and also logo???



Please help me I am thanking you in advance.



BR,



Asif Ahmed Khan

Sr. Software Enginner

Palmchip Pvt. Ltd


Hi all,

 

I am having some issues when attempting to create a user for the customer portal. I am running on a sandbox org and have created the portal. I have added the Enable Customer Portal User button to the contact page layout but when I view a Contact this button does not appear. I am logged in as an administrator. I had a similar problem with the "Allow Customer Portal Self-Registration" field but after changing the field level security settings I could see the field. Does anyone have an clues as to why the button would not appear on the page layout?

 

Thanks

 

James 

 

hi

 

can u please tell me how to send email to multiple users by using visual force email template. if i send email to single user i am using setTargetObjectId(objContact.Id) and setWhatId(SR.Id). but i am not getting how to send to multiple users.

 

Please help me

  • September 17, 2009
  • Like
  • 0

I have a custom object (Eval_Forecast__c) and some email templates.

 

In a trigger, I would like to send an email using those templates populating the dynamic text of the template. I can get the email to send, but the problem is the dynamic text is not populated.

 

When I set the WhatId (which seems to be what I need to do), I get the error:

 

SendEmail failed. First exception on row 0; first error: INVALID_ID_FIELD, WhatId is not available for sending emails to UserIds.

 

 

Here is the Apex code:

 

Messaging.SingleEmailMessage emailOut = new Messaging.SingleEmailMessage(); if(forecast.Stage__c =='Submitted to Sales Operations') { emailOut.setTemplateId('00XQ0000000QCUo'); } if(forecast.Stage__c =='Sales Order Released') { emailOut.setTemplateId('00XQ0000000QCV3'); } if(forecast.Stage__c =='Closed Cancelled') { emailOut.setTemplateId('00XQ0000000QCV8'); } emailOut.setTargetObjectId(user.Id);

 

Here is a sample of the template code:

 

*** Sales Order Has Been Released *** Eval Forecast Name: {!Eval_Forecast__c.Name} Account Name: {!Eval_Forecast__c.Account_name__c} Sales Order Number: {!Eval_Forecast__c.Sales_Order_Number__c} IMTR Number : {!Eval_Forecast__c.IMTR_Number__c} Note: Your Sales Order has been removed from shipping block and is now elidgible to ship.

 

 thanks,

 

lee

 

 

I've just started working in the Force development platform and need to have a Workflow rule run on all contact records once a day to send an email reminder to sales people when a date matches the frequency they want to re-contact the prospect.

 

I want to have this date field checked daily on all prospects and if it matches today's date send the salesperson an email with basic conact info and then update the date field by adding the number of days specified in the frequency field to todays date.

I can get all of that done in the Force platform if I change the date field manually to today's date, but I want it to check all the Prospect records automatically and compare the Trigger date to Today().

I downloaded Cronkit but I don't have any experience with Apex (I have done some programming in ASP in the past) and don't know how to construct the custom batch job that Cronkit requires.

If someone has a sample of code that works in a similar way, or can tell me how it might be done without an add on like CronKit, I would really appreciate, I would really appreciate the info.

 

Thanks

  • August 18, 2009
  • Like
  • 0

I have Product object in salesforce and there are some products like 'MQX', 'ARC 600' etc

 

I am trying to get records through LIKE query like:

 

results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);

 

When I set filterby variable to "MQX" its not returning records :smileysad:... When I tried tro get records for "ARC"also givinig me NULL but when I ask for "600" then its returning fine also when I requested " MQX"  mean with one space as prefix also getting result but not getting exact match but getting like "Prodcut of MQX" etc......please have a look on following code

 

private void BindData(Integer newPageIndex)
    {
        try
        {
                string sortFullExp = sortExpression  + ' ' + sortDirection;
                searchText=sortFullExp;
                if(filterby == null || filterby == '')
                {                    
                      //searchText='Coming';
                }
                else if(filterby != '')    
                {
                       
                        results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);
                      
                      
                    
                }                         
    
            pageResults = new List<Product2>();
            Transient Integer counter = 0;
            Transient Integer min = 0;
            Transient Integer max = 0;
            if (newPageIndex > pageNumber)
            {
                min = pageNumber * pageSize;
                max = newPageIndex * pageSize;
            }
            else
            {
                max = newPageIndex * pageSize;
                min = max - pageSize;
                //min = (min <>
            }
            for(Product2 a : results)
            {    
                counter++;
                if (counter > min && counter <= max)
                    pageResults.add(a);
            }
            pageNumber = newPageIndex;
            if (pageResults == null || pageResults.size() <= 0)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'Data not available for this view.'));
               results=null;
               pageResults=null;
            }
        }
        catch(Exception ex)
        {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,ex.getMessage()));
        }
    }

 

I have 7000 products in my object. Please help me in this. I want to get actual records for LIKE query.. Please reply ASAP Thanks in advance.

I have Product object in salesforce and there are some products like 'MQX', 'ARC 600' etc

 

I am trying to get records through LIKE query like:

 

results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);

 

When I set filterby variable to "MQX" its not returning records :smileysad:... When I tried tro get records for "ARC"also givinig me NULL but when I ask for "600" then its returning fine also when I requested " MQX"  mean with one space as prefix also getting result but not getting exact match but getting like "Prodcut of MQX" etc......please have a look on following code

 

private void BindData(Integer newPageIndex)
    {
        try
        {
                string sortFullExp = sortExpression  + ' ' + sortDirection;
                searchText=sortFullExp;
                if(filterby == null || filterby == '')
                {                    
                      //searchText='Coming';
                }
                else if(filterby != '')    
                {
                       
                        results = Database.query('select Id,Name,Product_Group__c from Product2 where Name Like :filterby OR Name Like \'%'+filterby+'%\'  order by ' + sortFullExp);
                      
                      
                    
                }                         
    
            pageResults = new List<Product2>();
            Transient Integer counter = 0;
            Transient Integer min = 0;
            Transient Integer max = 0;
            if (newPageIndex > pageNumber)
            {
                min = pageNumber * pageSize;
                max = newPageIndex * pageSize;
            }
            else
            {
                max = newPageIndex * pageSize;
                min = max - pageSize;
                //min = (min <>
            }
            for(Product2 a : results)
            {    
                counter++;
                if (counter > min && counter <= max)
                    pageResults.add(a);
            }
            pageNumber = newPageIndex;
            if (pageResults == null || pageResults.size() <= 0)
            {
                ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'Data not available for this view.'));
               results=null;
               pageResults=null;
            }
        }
        catch(Exception ex)
        {
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.FATAL,ex.getMessage()));
        }
    }

 

I have 7000 products in my object. Please help me in this. I want to get actual records for LIKE query.. Please reply ASAP Thanks in advance.

hi,

 

i have created one Apex Trigger under Task section, that is working fine in sandbox account. when i am trying to deploy the same Trigger in to production, i am getting "Average test coverage across all Apex Classes and Triggers is 72%, at least 75% test coverage is required". i am using Eclipse for deployment.

 

my Requirement is upon clicking save buttion on new Task page, i need to fire an trigger to get last completed task comments to merge with the current comments.

 

 

Here is the my Trigger:

 

trigger Update_Comments_Task on Task (before insert) {

 

List<Id> whoIds = new List<Id>();

 

for(Task oTask : Trigger.new){

whoIds.add(oTask.WhoId);

}

 

//Get Existing Tasks

List<Task> exTask =[select Id,Description from Task where WhoId in :whoIds and status = 'Completed' Order by CreatedDate Desc];

 

for(Task oTask : Trigger.new){

if(exTask.Size() > 0){

for(Task tmpTask:exTask){

if(oTask.Description!=null && tmpTask.Description!=null){oTask.Description = tmpTask.Description +

'\n' + oTask.Description;

}

else if(oTask.Description==null && tmpTask.Description!=null){

oTask.Description = tmpTask.Description;

}

else if(oTask.Description!=null && tmpTask.Description==null){

oTask.Description = oTask.Description;

}

else{oTask.Description = '';

}

break;

}

}

 

}

}

 

 

the above Trigger is working fine in sandbox account.

Can you please help me, how can i improve my test  coverage percentage to 75%.

I have created a component using CSS that I want to include into our Customer Portal HomePage. It looks like this

 

 

I have tried to upload the CSS and Images as Documents in SF and then creating a New Homepage Component using HTML referencing the '\<Image Name>' and '\<CSS Name>' from Documents within the HTML Component with no joy. It will display the text but not the CSS layout.

 

So then I thought I would maybe try all of this using a Visualforce Component with the CSS and images in Static Resources and then call the Visualforce Component, using javascript, into a HTML Homepage Component but I am not having much joy with that either.

 

Can anyone help me? I need some simple instuctions as to how to go about putting the above into mt Portal Homepage.

 

Thanks

i understand that it's possible to pull the related object info into the body of the email, but is it possible to pull related object info into the subject line.

 

Here's an example which works, because it's a non-dynamic subject line:

 

<messaging:emailTemplate subject="A non-dynamic subject" recipientType="Contact" relatedToType="Case"> <messaging:plainTextEmailBody > Congratulations! This is your new Visualforce Email Template. </messaging:plainTextEmailBody> </messaging:emailTemplate>

 This is what i'd like to do

 

<messaging:emailTemplate subject="{!case.product__c} Case: {!case.casenumber} - {!case.subject}" recipientType="Contact" relatedToType="Case"> <messaging:plainTextEmailBody > Congratulations! This is your new Visualforce Email Template. </messaging:plainTextEmailBody> </messaging:emailTemplate>

 

 but when saving, salesforce complains about the Case controller.

 

Hello all:

 

So my question concerns a complicated situation. I'm new enough to packaging that I'm not at all sure I'm going to state the problem accurately but I'll try.

 

I'm part of a team working on a Force.com app. The org in which we're working has a development sandbox, a test/QA environment, and a production environment. We're using the Force.com Eclipse IDE for pretty much everything, including migration from dev to test.

 

A few weeks ago we tried to push to production. We encountered an error that prevented our tests from running, and we're following up on that issue with SFDC so that's a separate converstion.

 

Here's the nub. To get our app deployed it was recommended we instead upload our package to production via the web interface. This seems to have worked, net the usual tinkering. We uploaded as an unmanaged package.(Side note: am I right in thinking this involved somehow funneling the app through the AppExchange?)

 

The problem is that now we can no longer deploy using our original package, the one recognized by the IDE and the one we use to keep our project definition together. What we've now been told by those who specialize in deployment in this org is that we can only deploy to production using Ant, and sending the deployer a listof all the changed components so that an Ant script can be pulled together that just updates those components.

 

I can tell there are things I still just don't "get" about packages and migration, and I know the above is a lot to wade through, but I'm curious whether any can tell me what was different about uploading the package via the web UI, and why our Eclipse IDE deployments apparently no longer work.

 

Any insight greatfully received.

 

-- Steve Lane

  • March 10, 2009
  • Like
  • 0
For some reason, whenever I use a record ID within a custom link or button, Salesforce is passing in the 15-character ID instead of the 18-character ID. In the past, I have coded around this on my own (using case-sensitive comparisons and substrings) but I'm now running into an issue where it's not possible to use these tricks.

Why is SF only passing the 15-character ID and how do I make it use the 18-character ID?

Thanks,
Mike
I am having trouble sending email using MassEmailMessage. At this point I am only sending a single email to one contact, but MassEmailMessage seems to be the only way to programmatically send an email using an existing template.

I'm using the code below in an s-control attached to a button on the Contact form, and everything seems to run fine. The alert() pops up a message that says {success:'true',}, and the resulting page says Email sent! as shown in the code. If I look at Setup | Monitoring | Mass Email Monitoring, the send is shown there as successful. But the email never arrives. (For testing, I'm sending it to myself. No, it's not in my spam filter.)

I am able to use SingleEmailMessage with no problem.

What am I doing wrong? Thanks for any pointers!

Don

Code:
<html>
   <head>
   <script src="/soap/ajax/10.0/connection.js" type="text/javascript"></script>
   <script>
      var contactId = "{!Contact.Id}";
      function sendEmail() {
            var result = "";
            try {
                        var templResp = sforce.connection.query("select id from emailtemplate where name = 'Welcome!'");
                        var templateID = templResp.getArray("records")[0].Id;
                        var mass = new sforce.MassEmailMessage();
            
                        mass.replyTo = "donkiely@computer.org";
                        mass.subject = "Mass Email from SF!";
                        var a = new Array(1);
                        a[0] = contactId;
                        mass.targetObjectIds = a;
                        mass.saveAsActivity = true;
                        mass.templateId = templateID;
                        var sendMailRes = sforce.connection.sendEmail([mass]);
                        
                        alert(sendMailRes);

                     output.innerHTML = "Email sent! " + "result: " + result;
            } catch(error) {
                        output.innerHTML = error + ":result = " + result;
            }
      }
   </script>
   <body onload="sendEmail()">
      <div id="output"></div>
   </body>
</html>

Message Edited by RiverChaser on 09-09-2007 12:30 PM