• AmbigaRam
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 35
    Questions
  • 29
    Replies

 

Hi,

 

I wrote the trigger for sending email with email template .


I need to send some persons as in CC address.

 

The Following is my trigger, Is there an possiblity to add ccaddress in that code. I also want to set orgWideAddress when it is equal to the value in CaseEmail__c.

 

Please help me.

trigger mailnotification on Case (after insert) {
for(case c:trigger.new){
EmailTemplate etc =[SELECT id from EmailTemplate where Name =:'Case Email to Customer'];
If((c.ContactId != null ) ||(c.SuppliedEmail != null)){
Messaging.SingleEmailMessage m = new Messaging.SingleEmailMessage();
m.setTemplateId(etc.id);
for( OrgWideEmailAddress owa : [select id, Address, DisplayName from OrgWideEmailAddress]){
If(owa.Address==c.CaseEmail__c)
m.setOrgWideEmailAddressId(owa.id);}
String userEmail = c.CaseEmail__c;  
m.setReplyTo(userEmail);
m.setTargetObjectId(c.contactId);
m.setWhatId(c.id);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { m });
}
}
}

 

Hi,

 

I wrote the trigger for sending email to contact when the case is opened.

 

I used the email template . In that , I need to pass my value of case number. So I tried like this {!Case.CaseNumber} in template.

 

But It dint show any case number.

 

I need to show the case number in subject using email templates and apex trigger.

 

Note :When Use the same email template in workflow rules , It works and shows the case number in subject.

 

But I am in need of apex trigger for sending email using templates which shows the case Number.

 

Please help to fix this problem.

 

Thanks & Regards.

Ambiga

Hi,

 

I need to write apex method for mapping the fields in the same custom object.

 

Can any one help for me this?

 

Thanks and Regards.,

Ambiga.R

Hi,

 

I need to copy the project name when the new case is created by email

 

For that I created new custom settings "CaseProject" with custom fields CaseEmail (field Email) It contains the values of ToAddress of  the email message.

 

Following are my trigger code, When I saved ,I get the complation Error:unexpected token: 'Map' at line 15 column 8

 

Please help me to solve this issue.

 

trigger UpdateMostRecentmessageOnCase on EmailMessage (after insert) {
    Case relatedCase;
    Contact relatedCaseContact;
   
    
    for (EmailMessage e_msg : trigger.new) {
        //Find the related case.
        relatedCase = [SELECT Id FROM Case WHERE Id = :e_msg.ParentId];
        Integer msgCount = [SELECT COUNT() FROM EmailMessage];
       If (relatedCase != null)
            {
        //If the case was found, updated the most recent comment.
       If(e_msg.ToAddress != null)
       {
        Map prjts = CaseProject__c.getAll();
        List mails = new List();
        mails.addAll(prjts.keySet());
        for (String key : mails) {
            CaseProject__c cToP = prjts.get(key);
            if(cToP.ProjectEmail__c.equals(e_msg.ToAddress)) {
           relatedCase.Project_Name__c = cTop.Name; 
            }
        }  
       
            
            relatedCase.Most_Recent_Email_Message__c = e_msg.textBody;
            relatedCase.CaseEmail__c = e_msg.ToAddress;
            update relatedCase;
            
           
            
            
            }
            }
            
         
    }
}

 Thanks and Regards.,

Ambiga

Hi, 

 

I created the pre defined  case team  with member role. When I add this with workflow actions as recipients,  It does nt send any emails.

 

For checking that workflow actions, I added my mail id to the "Additional email field. It recieved the mail as per the work flow rule. but not my case team.

 

Can anybody help me to fix this issue?

 

Regards.,

Ambiga

Hi,

 

I created the new custom picklist field "Project"  in my case object. The values of the fields"Project" are same as per the records in account.

 

If a customer opens the case via customer portal, he need to see only his project in that portal. The other values should be hidden. 

 

Please can any one help me to set this?

 

Thanks and regards.,

Ambiga.R

Hi,

 

Can anyone help me to write the apex trigger for snding email notifcation to the customer when the new case is created using email template and email notification for assigning the case to the case team and case owner(queues)?

 

 

Please help me.

 

 

Thanks.,

Ambiga

Hi,

 

I  wrote the email handler to append the inbound emails based on case number to the case.

 

I want to count the emails in the parent case. I cant use rollup summary field because case object is not parent.

 

Can anybody help me to count the number of email messages in case.

 

 

Thanks.,

Ambiga

Hi,

 

 

I deployed the email handler class from my sandbox account to production account. I searched for email service to deploy,But I cant.

 

Is there any option to deploy the email autogenerated address from sandbox to production?

 

Or should i again generate it via Email service?

 

Please help me to solve this?

 

Thanks.,

Ambiga

Hi,

 

How to denote in the work flow rule, when the custom field value is changed ?

 

For an example,In a record, The initial value of the subject (Text) is "New column", then it is modified by the user as "Forming Tables".

 

How to denote the changes of the value of the subject in work flow rules?

 

Please can any one help for this?

 

 

Regards.,

Ambiga

 

Hi,

 

I wrote the following code for sending email notification to customer, contact and case owner (users in queue) when there is change in the case record.

 

the conditions are, sender address : contact email

                                 

                                   CC address       : Web email

 

                                   BCC address    : Case owner (users in queue)  and users in Case Team.

 

For sending email to contact and webmail, I wrote.

trigger caseUpdationMailNotification on Case (after update) {
    Set<Id> conIds = new Set<Id>();
    List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
    for (Case c: trigger.new) {
        conIds.add(c.ContactId);
    }
    Map<Id, Contact> conMap = new Map<Id, Contact>([SELECT Id, Email FROM Contact WHERE Id In :conIds]);
       for (Case c : trigger.new) {
        Contact relatedCaseContact = conMap.get(c.ContactId);
        Messaging.SingleEmailMessage CaseNotificationmail = new Messaging.SingleEmailMessage();  
        CaseNotificationmail.setToAddresses(new List<String> { relatedCaseContact.Email });
        CaseNotificationmail.setReplyTo('case2email@y-1zk8ulh2xsm24t92q30hootymudvrh3i38tjl5mli2n9yuqfiq.k-w0fefmaj.k.apex.sandbox.salesforce.com');
        CaseNotificationmail.setSenderDisplayName('Salesforce Support');            
        string oldcomment = trigger.oldMap.get(c.id).Most_Recent_Case_Comment__c;
        string oldMsg = trigger.oldMap.get(c.id).Most_Recent_Email_Message__c;
        String oldStatus = trigger.oldMap.get(c.id).status;
        
        if (c.status != oldStatus) {
          CaseNotificationmail.setToAddresses(new List<String> { relatedCaseContact.Email });
          If(c.SuppliedEmail!=null)
          {
          CaseNotificationmail.setCcAddresses(new List<string>{c.SuppliedEmail});
          }
          CaseNotificationmail.setSubject(' Case Status updation : ' + 'Changed to ' + c.status + '. Case:' + c.CaseNumber);
          CaseNotificationmail.setPlainTextBody('Your case Status: ' + c.CaseNumber ); 
        }
       else if((c.Most_Recent_Case_Comment__c  != oldcomment)&&(oldcomment != null))
        {
         CaseNotificationmail.setToAddresses(new List<String> { relatedCaseContact.Email });
          If(c.SuppliedEmail!=null)
          {
          CaseNotificationmail.setCcAddresses(new List<string>{c.SuppliedEmail});
          }
         CaseNotificationmail.setSubject(' New Case comment is inserted '  + 'in Case:' + c.CaseNumber);
          CaseNotificationmail.setPlainTextBody('New Case comment is inserted . and the casecomment is " ' +c.Most_Recent_Case_Comment__c  + '" in Case Number:' + c.CaseNumber ); 
        }
        else if  ((c.Most_Recent_Email_Message__c != oldMsg)&&(oldMsg != null))
                {
           CaseNotificationemail.setToAddresses(new List<String> { relatedCaseContact.Email });
          If(c.SuppliedEmail!=null)
          {
          CaseNotificationmail.setCcAddresses(new List<string>{c.SuppliedEmail});
          }
         CaseNotificationmail.setSubject(' New Case email message is inserted '  + 'in Case:' + c.CaseNumber);
          CaseNotificationmail.setPlainTextBody('New Email message  is inserted . and the message is "' +c.Most_Recent_Email_Message__c + '" in Case Number:' + c.CaseNumber ); 
        }
        else {
         CaseNotificationmail.setToAddresses(new String[] {'test.salesforceemail2case@gmail.com'});
         CaseNotificationmail.setSubject(' Case is updated '  + 'in Case:' + c.CaseNumber);
         CaseNotificationmail.setPlainTextBody('Case is updated in Case Number:' + c.CaseNumber ); 
           }
       mails.add(CaseNotificationmail); 
    }
    Messaging.sendEmail(mails);
}

 

But I dont have idea , how to send to the mass mail to case owner,

 

Can any one help for this?

 

Thanks.,

Ambiga

Hi,

 

Can anybody help me to write the test coding for the following email inbound handler?

 

global class CaseEmailInBoundHandler implements Messaging.InboundEmailHandler {

    global Messaging.InboundEmailResult handleInboundEmail(
       Messaging.InboundEmail email,
       Messaging.InboundEnvelope envelope) {

 CaseEmailInBoundUtilities handler = new CaseEmailInBoundUtilities();
        Messaging.InboundEmailResult result = handler.processInboundEmail(email);
        return result;        
    }
}

 Thanks and Regards.,

Ambiga

Hi,

 

I have enabled the customer portal and configured it.

 

I also created the trigger which sends the notification when the case is created either via email or customer portal.

 

The following is my trigger code,

trigger mailNotification on Case ( after insert) {
    contact CaseContact;
    
    for(case Cases :trigger.new){
                    //Fetch the related case contact.
                
          Messaging.SingleEmailMessage CaseNotificationmail = new Messaging.SingleEmailMessage

(); 
          if (CaseContact!= null){ 
          CaseContact = [SELECT Email FROM Contact WHERE Id = :Cases.ContactId];                 

 
                if (CaseContact != null && CaseContact.Email != null) {
    CaseNotificationmail.setToAddresses(new List<string> {CaseContact.Email});
    } }
    else {
    CaseNotificationmail.setToAddresses(new List<string> {Cases.SuppliedEmail});
    }
    CaseNotificationmail.setReplyTo('createcases@i-

1byw7u3dtfg21ai2tii0rpnf6q345ovsuuelzkgmta35336rgt.9-mqfdeae.9.apex.salesforce.com');
    CaseNotificationmail.setSenderDisplayName('Salesforce Support');
    CaseNotificationmail.setSubject('New Case Created : ' + Cases.CaseNumber);
    CaseNotificationmail.setPlainTextBody('Your case:<b> ' + Cases.CaseNumber +' has been 

created.'+'To view your case <a href=https://na1.salesforce.com/'+case.Id);
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { CaseNotificationmail });
 }  
}

 

 

When I used this trigger, I cant create the new case by customer portal.

 

It shows the following error

"

Error: Invalid Data.

Review all error messages below to correct your data.
Apex trigger mailNotification caused an unexpected exception, contact your administrator: mailNotification: execution of AfterInsert caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, Invalid to address : null: []: Trigger.mailNotification: line 20, column 1"

 

If i am using workflow rules , I will not include the sepecified address for reply.

 


Can anybody help to solve this problem?

 

Regards.,

Ambiga

 

Hi,

The following is the content of my email template, and my template name is "Case email"

"Thanks , Your case number is {!Case.CaseNumber}"


And my Apex Trigger to send the email, when the case is created.

 

trigger mailNotification on Case ( after insert) {
    contact CaseContact;
    
    for(case Cases :trigger.new){
                    //Fetch the related case contact.
                CaseContact = [SELECT Email FROM Contact WHERE Id = :Cases.ContactId];
                if (CaseContact != null && CaseContact.Email != null) {
    Messaging.SingleEmailMessage CaseNotificationmail = new Messaging.SingleEmailMessage();
    EmailTemplate template = [SELECT Id, Subject, HtmlValue, Body FROM EmailTemplate WHERE Name = 'Case Email '];
    CaseNotificationmail.setToAddresses(new List<String> { CaseContact.Email });
    CaseNotificationmail.setReplyTo('someone@salesforce.com');
    CaseNotificationmail.setSenderDisplayName('Salesforce Support');
    CaseNotificationmail.setTargetObjectId(CaseContact.Id);
    CaseNotificationmail.setTemplateId(template.id);
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { CaseNotificationmail });
 } 
  
}

}

  after creating the case, It sends the mail, but It does nt show the case number.

 

Can anybody help for this?

 

Regards.,

Ambiga.R

Hi,

 

I created the workflow rule when the new case comment is inserted.

 

The following is the rule criteria.

"Case Comment: PublishedEQUALSTrue"

 

and the workflow action is to send the email notification.

 

But when the new case comment is inserted, It does not send email

 

Can anyone help to solve this problem?

 

Thanks and Regards.,

Ambiga

 

Hi,

 

I am trying to write the  Trigger code when the status of the case is changed and any other changes in fields with conditional loops for changing the Mail subject.

 

The issue was on trigger that send the same mail subject when i changed the status or changed the iother fields in the case.

 

The following is my code,

trigger caseUpdationMailNotification on Case ( after update) {
    contact relatedCaseContact;
    CaseComment Cscmnt;
    for(case Cases :trigger.new){
    relatedCaseContact = [SELECT Email FROM Contact WHERE Id = :Cases.ContactId];
      Messaging.reserveSingleEmailCapacity(1);
               //Fetch the related case contact.
       Messaging.SingleEmailMessage CaseNotificationmail = new Messaging.SingleEmailMessage();  
       CaseNotificationmail.setToAddresses(new List<String> { relatedCaseContact.Email });
       CaseNotificationmail.setReplyTo('ambigaraman@gmail.com');
       CaseNotificationmail.setSenderDisplayName('Salesforce Support');            
      
	  If(Cases.Status =='Working'){      
       CaseNotificationmail.setSubject(' Case Status updation : ' +'Changed to working. '+'Case Number:' + Cases.CaseNumber);
       CaseNotificationmail.setPlainTextBody('Your case Status: ' + Cases.CaseNumber +'To view your case <a href=https://na1.salesforce.com/'+Cases.Id);}
       
  If(Cases.Status =='Escalated'){          
   
    CaseNotificationmail.setSubject(' Case Status updation : ' +'Changed to Escalated. '+ 'Case Number:' +Cases.CaseNumber);
    CaseNotificationmail.setPlainTextBody('Your case Status: ' + Cases.CaseNumber +' has been updated.'+'To view your case <a href=https://na1.salesforce.com/'+Cases.Id);
    }   
    
 If(Cases.Status =='closed'){           
    
    CaseNotificationmail.setSubject(' Case Status updation : ' +'Changed to closed. '+ 'Case Number:' +Cases.CaseNumber);
    CaseNotificationmail.setPlainTextBody('Your case Status:' + Cases.CaseNumber +' has been updated.'+'To view your case <a href=https://na1.salesforce.com/'+Cases.Id);
    }     
else{  
    CaseNotificationmail.setSubject(' Case  updation : ' + 'Case Number:'+ Cases.CaseNumber);
    CaseNotificationmail.setPlainTextBody('Your case : ' + ' has been updated.'+'To view your case <a href=https://na1.salesforce.com/'+Cases.Id);
    } 
	
	
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { CaseNotificationmail });
 }
}

 If i use 'elseif', It again send the email with subject for status changed,

 

Can anyone help me to write the trigger that send the mail that send when we change the status only. or there is only changes in other fields(not in status) of the case?

 

Thanks & Regards.,

Ambiga

 

Hi,

 

 

I wrote the code which sends mail when the case is created.

 

Can anybody help  to write the code for testing?

 

Tha following is the code.

trigger mailNotification on Case ( after insert) {
    contact CaseContact;
    
    for(case Cases :trigger.new){
                    //Fetch the related case contact.
                CaseContact = [SELECT Email FROM Contact WHERE Id = :Cases.ContactId];
                if (CaseContact != null && CaseContact.Email != null) {
    Messaging.SingleEmailMessage CaseNotificationmail = new Messaging.SingleEmailMessage();
    
    CaseNotificationmail.setToAddresses(new List<String> { CaseContact.Email });
    CaseNotificationmail.setReplyTo('ambigaraman@gmail.com');
    CaseNotificationmail.setSenderDisplayName('Salesforce Support');
    CaseNotificationmail.setSubject('New Case Created : ' + Cases.Id);
    CaseNotificationmail.setPlainTextBody('Your case:<b> ' + Cases.Id +' has been created.'+'To view your case <a href=https://na1.salesforce.com/'+case.Id);
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { CaseNotificationmail });
 }  
}

}

 Anyhelp is appreciated

Hi,

 

I want to write the trigger which send the email notifications when the case is closed.

 

Can any one help for this?

 

 

Regards.,

R.Ambiga

Hi,

 

I created the list of child records by means of rowfunctionality.

 

I want to insert those above said  child records in my single parent object.

 

For an example, If student want to enter the details, he will enter his all personal details. For entering his curriclum(ChildObject), The page redirects another page  to enter the details for (child object) i.e row functionality. after saving, It again redirects him to the existing page i.e parent object with partial filled values.

 

 

Can anyone help for this?

 

Thanks.,

Ambiga.

Hi, 

 

I want to show the list of records with the link using VF page.

 

When I click any one of the  link of the record from list, It  has to show the details of the record.

 

Can anyone help for this?

 

Thanks and Regards.,

R.Ambiga

Hi,

 

I need to copy the project name when the new case is created by email

 

For that I created new custom settings "CaseProject" with custom fields CaseEmail (field Email) It contains the values of ToAddress of  the email message.

 

Following are my trigger code, When I saved ,I get the complation Error:unexpected token: 'Map' at line 15 column 8

 

Please help me to solve this issue.

 

trigger UpdateMostRecentmessageOnCase on EmailMessage (after insert) {
    Case relatedCase;
    Contact relatedCaseContact;
   
    
    for (EmailMessage e_msg : trigger.new) {
        //Find the related case.
        relatedCase = [SELECT Id FROM Case WHERE Id = :e_msg.ParentId];
        Integer msgCount = [SELECT COUNT() FROM EmailMessage];
       If (relatedCase != null)
            {
        //If the case was found, updated the most recent comment.
       If(e_msg.ToAddress != null)
       {
        Map prjts = CaseProject__c.getAll();
        List mails = new List();
        mails.addAll(prjts.keySet());
        for (String key : mails) {
            CaseProject__c cToP = prjts.get(key);
            if(cToP.ProjectEmail__c.equals(e_msg.ToAddress)) {
           relatedCase.Project_Name__c = cTop.Name; 
            }
        }  
       
            
            relatedCase.Most_Recent_Email_Message__c = e_msg.textBody;
            relatedCase.CaseEmail__c = e_msg.ToAddress;
            update relatedCase;
            
           
            
            
            }
            }
            
         
    }
}

 Thanks and Regards.,

Ambiga

Hi, 

 

I created the pre defined  case team  with member role. When I add this with workflow actions as recipients,  It does nt send any emails.

 

For checking that workflow actions, I added my mail id to the "Additional email field. It recieved the mail as per the work flow rule. but not my case team.

 

Can anybody help me to fix this issue?

 

Regards.,

Ambiga

Hi,

 

I created the new custom picklist field "Project"  in my case object. The values of the fields"Project" are same as per the records in account.

 

If a customer opens the case via customer portal, he need to see only his project in that portal. The other values should be hidden. 

 

Please can any one help me to set this?

 

Thanks and regards.,

Ambiga.R

Hi,

 

Can anyone help me to write the apex trigger for snding email notifcation to the customer when the new case is created using email template and email notification for assigning the case to the case team and case owner(queues)?

 

 

Please help me.

 

 

Thanks.,

Ambiga

Hi,

 

How to denote in the work flow rule, when the custom field value is changed ?

 

For an example,In a record, The initial value of the subject (Text) is "New column", then it is modified by the user as "Forming Tables".

 

How to denote the changes of the value of the subject in work flow rules?

 

Please can any one help for this?

 

 

Regards.,

Ambiga

 

Hi,

 

Can anybody help me to write the test coding for the following email inbound handler?

 

global class CaseEmailInBoundHandler implements Messaging.InboundEmailHandler {

    global Messaging.InboundEmailResult handleInboundEmail(
       Messaging.InboundEmail email,
       Messaging.InboundEnvelope envelope) {

 CaseEmailInBoundUtilities handler = new CaseEmailInBoundUtilities();
        Messaging.InboundEmailResult result = handler.processInboundEmail(email);
        return result;        
    }
}

 Thanks and Regards.,

Ambiga

Hi,

The following is the content of my email template, and my template name is "Case email"

"Thanks , Your case number is {!Case.CaseNumber}"


And my Apex Trigger to send the email, when the case is created.

 

trigger mailNotification on Case ( after insert) {
    contact CaseContact;
    
    for(case Cases :trigger.new){
                    //Fetch the related case contact.
                CaseContact = [SELECT Email FROM Contact WHERE Id = :Cases.ContactId];
                if (CaseContact != null && CaseContact.Email != null) {
    Messaging.SingleEmailMessage CaseNotificationmail = new Messaging.SingleEmailMessage();
    EmailTemplate template = [SELECT Id, Subject, HtmlValue, Body FROM EmailTemplate WHERE Name = 'Case Email '];
    CaseNotificationmail.setToAddresses(new List<String> { CaseContact.Email });
    CaseNotificationmail.setReplyTo('someone@salesforce.com');
    CaseNotificationmail.setSenderDisplayName('Salesforce Support');
    CaseNotificationmail.setTargetObjectId(CaseContact.Id);
    CaseNotificationmail.setTemplateId(template.id);
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { CaseNotificationmail });
 } 
  
}

}

  after creating the case, It sends the mail, but It does nt show the case number.

 

Can anybody help for this?

 

Regards.,

Ambiga.R

Hi,

 

I created the workflow rule when the new case comment is inserted.

 

The following is the rule criteria.

"Case Comment: PublishedEQUALSTrue"

 

and the workflow action is to send the email notification.

 

But when the new case comment is inserted, It does not send email

 

Can anyone help to solve this problem?

 

Thanks and Regards.,

Ambiga

 

Hi,

 

I am trying to write the  Trigger code when the status of the case is changed and any other changes in fields with conditional loops for changing the Mail subject.

 

The issue was on trigger that send the same mail subject when i changed the status or changed the iother fields in the case.

 

The following is my code,

trigger caseUpdationMailNotification on Case ( after update) {
    contact relatedCaseContact;
    CaseComment Cscmnt;
    for(case Cases :trigger.new){
    relatedCaseContact = [SELECT Email FROM Contact WHERE Id = :Cases.ContactId];
      Messaging.reserveSingleEmailCapacity(1);
               //Fetch the related case contact.
       Messaging.SingleEmailMessage CaseNotificationmail = new Messaging.SingleEmailMessage();  
       CaseNotificationmail.setToAddresses(new List<String> { relatedCaseContact.Email });
       CaseNotificationmail.setReplyTo('ambigaraman@gmail.com');
       CaseNotificationmail.setSenderDisplayName('Salesforce Support');            
      
	  If(Cases.Status =='Working'){      
       CaseNotificationmail.setSubject(' Case Status updation : ' +'Changed to working. '+'Case Number:' + Cases.CaseNumber);
       CaseNotificationmail.setPlainTextBody('Your case Status: ' + Cases.CaseNumber +'To view your case <a href=https://na1.salesforce.com/'+Cases.Id);}
       
  If(Cases.Status =='Escalated'){          
   
    CaseNotificationmail.setSubject(' Case Status updation : ' +'Changed to Escalated. '+ 'Case Number:' +Cases.CaseNumber);
    CaseNotificationmail.setPlainTextBody('Your case Status: ' + Cases.CaseNumber +' has been updated.'+'To view your case <a href=https://na1.salesforce.com/'+Cases.Id);
    }   
    
 If(Cases.Status =='closed'){           
    
    CaseNotificationmail.setSubject(' Case Status updation : ' +'Changed to closed. '+ 'Case Number:' +Cases.CaseNumber);
    CaseNotificationmail.setPlainTextBody('Your case Status:' + Cases.CaseNumber +' has been updated.'+'To view your case <a href=https://na1.salesforce.com/'+Cases.Id);
    }     
else{  
    CaseNotificationmail.setSubject(' Case  updation : ' + 'Case Number:'+ Cases.CaseNumber);
    CaseNotificationmail.setPlainTextBody('Your case : ' + ' has been updated.'+'To view your case <a href=https://na1.salesforce.com/'+Cases.Id);
    } 
	
	
    Messaging.sendEmail(new Messaging.SingleEmailMessage[] { CaseNotificationmail });
 }
}

 If i use 'elseif', It again send the email with subject for status changed,

 

Can anyone help me to write the trigger that send the mail that send when we change the status only. or there is only changes in other fields(not in status) of the case?

 

Thanks & Regards.,

Ambiga

 

Hi,

 

I want to write the trigger which send the email notifications when the case is closed.

 

Can any one help for this?

 

 

Regards.,

R.Ambiga

Hi, 

 

I want to show the list of records with the link using VF page.

 

When I click any one of the  link of the record from list, It  has to show the details of the record.

 

Can anyone help for this?

 

Thanks and Regards.,

R.Ambiga

Hi,

 

I am creating the page which consists some fields that are not present in row and some other fields that are present in row.

 

I created the custom controller which add the row  functionality in my page.

 

When I am going to save the page , It does not save the page which is in need of other fields (not in row) .

 

Can anyone help for me to show how to save by means of pagereference method  fields (in rows and not in rows)?

 

The following are my code,

Public class MultiAddRowFn{

//Will hold the master records to be saved
public list<Mentor__c>  lstmarf= new list<Mentor__c>();

//List of the inner class
public list<innerClass> lstInner
{get;set;}

//Will indicate the rows to be deleted
public string selectedRowIndex
{get;set;}

//no.of rows added/records in the inner class list
public integer count=1;

////save the records by adding the elements in the inner class list to lstAcct,return to the same page
Public pageReference save()
{
 PageReference pr = new PageReference('/apex/MultiAddRowFn');

for(integer j=0; j<lstInner.size(); j++)
{
lstmarf.add(lstInner[j].ment);
}
update lstmarf;
pr.setRedirect(True);
return pr;
}
//add one or more row
public void add()
{
count=count+1;
addMore();
}

//Begin addMore
public void addMore()
{
innerClass objInnerClass = new innerClass(count);

//add the record to the inner class list
lstInner.add(objInnerClass);
system.debug('lstInner---->'+lstInner);
}/*end add more*/

/*Begin Delete*/
 public void Del()
    {
        system.debug('selected row index---->'+selectedRowIndex);
        lstInner.remove(Integer.valueOf(selectedRowIndex)-1);
        count = count - 1;
        
    }/*End del*/
 /*Constructor*/
 public MultiAddRowFn(ApexPages.StandardController ctlr)
 {
 lstInner=new list<InnerClass>();
 addMore();
 selectedRowIndex ='0';
 }/*end constructor */
 
 /*Inner Class*/
 public class innerClass
 {
 public string recCount
 {get; set;}
 
 public Mentor__c ment
 {get; set;}
 
 public innerClass(Integer intCount)
 {
 recCount = string.valueof(intCount);
  ment=new Mentor__c();
  }
  }
 
 
}

 Thanks and Regards.,

Ambiga

Hi,

 

How to create the custom button "New" for creating the new record in lookup search field.

 

  

Can Any one help for this?

 

Thank you,

 

Regards,

Ambiga

Hi,

 

 

How i validate formula field?

 

 

 

regards,

Sagar

Hi ,

 

I want to create the page which shows the saved  record in detail. 

 

Can Any one help for this?

 

Thanks&Regards.,

Ambiga.

Hi,

 

Now I am creating the form for the applicants who want to enter their qualification ,

 

If they want to enter the additional Degree like Post Graduation , How can I create the button which add the another row which shows the same fields

 

For an example,,

 

Qualification:[   ]               Subject:[   ]              Grade:[   ]                Institution:[    ]         (Reomve)

 

Qualification:[   ]               Subject:[   ]              Grade:[   ]                Institution:[    ]         (Remove)

 

Qualification:[   ]               Subject:[   ]              Grade:[   ]                Institution:[    ]          (Add)

 

 

Note: By clicking "Remove" button ,the row should be removed & similarly by clicking the "Add" button, the new row should be added with same fields.

 

Can anybody help for this?

 

Thanks & Regards.,

Ambiga

Hi,

 

Now I am creating the form for the applicants who want to enter their qualification ,

 

If they want to enter the additional Degree like Post Graduation , How can I create the button which add the another row which shows the same fields

 

For an example,,

 

Qualification:[   ]               Subject:[   ]              Grade:[   ]                Institution:[    ]         (Reomve)

 

Qualification:[   ]               Subject:[   ]              Grade:[   ]                Institution:[    ]         (Remove)

 

Qualification:[   ]               Subject:[   ]              Grade:[   ]                Institution:[    ]          (Add)

 

 

Note: By clicking "Remove" button ,the row should be removed & similarly by clicking the "Add" button, the new row should be added with same fields.

 

Can anybody help for this?

 

Thanks & Regards.,

Ambiga

I created a custom button on a custom object and onclick, it should update the status to 'Completed' and the Completed date to NOW().  I tested it in Sandbox and it worked properly, I updated the field id's to Production and it worked the day I deployed it.  However it has not worked since I initially deployed it. 

Here are the details:

Detail Page Button

Behavior: Display in existing Window without Sidebar or Header
Content Source: URL

/{Setup_Request__c.Id}/e?retURL={Setup_Request__c.Id}&00N70000002jHJ9={!NOW()}&00N70000002jHKl=Completed&save=1

Link Encoding: Unicode (UTF-8)

The only other thing I've found online suggested changing the &save=1 to &save=0, but neither option has worked for me.

 

Then based on feedback I received in the Answers Community, I tried modifiying the code to some javascript so it would envoke onclick.  Every time I click on the button, I receive an error message saying 'Object Expected'.  Here is the code I'm using:

 

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")}

var sr = new sforce.SObject("Setup_Request__c");
sr.id = "{!Setup_Request__c.Id}";
sr.Status__c = 'Completed';
sr.Completed_Date__c = new Date();
result = sforce.connection.update([sr]);

window.location.reload();

 

Any help is greatly appreciated.