• SFDev@321
  • NEWBIE
  • 5 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 3
    Replies

<messaging:emailTemplate recipientType="Contact"

relatedToType="BS_Classic_Sales_log__c"

subject="Case report for BSCLASSIC: {!relatedTo.name}"

replyTo="noreply@bt.com" >
<messaging:htmlEmailBody >
<html>

<body>

<STYLE type="text/css">

TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: center }

TD {font-size: 11px; font-face: verdana }

TABLE {border: solid #CCCCCC; border-width: 1}

TR {border: solid #CCCCCC; border-width: 1}

</STYLE>

<font face="arial" size="2">
<p>Dear {!recipient.name},</p>

<p>Below is a list of BSproduct related to the BSSalesLOG: {!relatedTo.name}.</p>

<table border="0" >

<tr >

<th>Name of Product/Service</th><th>Type of Product/Service</th><th>Minimum Period/Commitment Period/Minimum Term*</th><th>Quantity</th>>

</tr>
<apex:repeat var="cx" value="{!relatedTo.BS_Classic_SL_Product__c}">

<tr>

 

<td>{!cx.Product__c}</td>

<td>{!cx.Product_Type2__c}</td>

<td>{!cx.Contact.email}</td>

<td>{!cx.Quantity__c}</td>

</tr>

</apex:repeat>
</table>

<p />

</font>

</body>

</html>
</messaging:htmlEmailBody>
<messaging:plainTextEmailBody >

Dear {!recipient.name},

 

[ Name of Product/Service ] - [ Type of Product/Service ] - [ Minimum Period/Commitment Period/Minimum Term* ] - [ Quantity ]

 

<apex:repeat var="cx" value="{!relatedTo.BS_Classic_SL_Product__c}">

[ {!cx.Product__c} ] - [ {!cx.Product_Type2__c} ] - [ {!cx.Contact.email} ] - [ {!cx.Quantity__c} ]

</apex:repeat>

 

</messaging:plainTextEmailBody>
</messaging:emailTemplate>

<messaging:emailTemplate recipientType="Contact"

relatedToType="BS_Classic_Sales_log__c"

subject="Case report for BSCLASSIC: {!relatedTo.name}"

replyTo="noreply@bt.com" >
<messaging:htmlEmailBody >
<html>

<body>

<STYLE type="text/css">

TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1; text-align: center }

TD {font-size: 11px; font-face: verdana }

TABLE {border: solid #CCCCCC; border-width: 1}

TR {border: solid #CCCCCC; border-width: 1}

</STYLE>

<font face="arial" size="2">
<p>Dear {!recipient.name},</p>

<p>Below is a list of BSproduct related to the BSSalesLOG: {!relatedTo.name}.</p>

<table border="0" >

<tr >

<th>Name of Product/Service</th><th>Type of Product/Service</th><th>Minimum Period/Commitment Period/Minimum Term*</th><th>Quantity</th>>

</tr>
<apex:repeat var="cx" value="{!relatedTo.BS_Classic_SL_Product__c}">

<tr>

 

<td>{!cx.Product__c}</td>

<td>{!cx.Product_Type2__c}</td>

<td>{!cx.Contact.email}</td>

<td>{!cx.Quantity__c}</td>

</tr>

</apex:repeat>
</table>

<p />

</font>

</body>

</html>
</messaging:htmlEmailBody>
<messaging:plainTextEmailBody >

Dear {!recipient.name},

 

[ Name of Product/Service ] - [ Type of Product/Service ] - [ Minimum Period/Commitment Period/Minimum Term* ] - [ Quantity ]

 

<apex:repeat var="cx" value="{!relatedTo.BS_Classic_SL_Product__c}">

[ {!cx.Product__c} ] - [ {!cx.Product_Type2__c} ] - [ {!cx.Contact.email} ] - [ {!cx.Quantity__c} ]

</apex:repeat>

 

</messaging:plainTextEmailBody>
</messaging:emailTemplate>

I have a custom obejct Sales_c in this i have 2 feilds:- 


1> competitor1_c :- Picklist
2> competitor2_c :- Picklist

 

Now, i have created another 2 look-up feilds :-

 

3> Comp1_c : Lookup feild
4> Comp2_c : Lookup feild


Now, i want to capture all picklist feilds(competitor1_c, competitor2_c) values in to look-up feilds (Comp1_c, Comp2_c).

 

 

Also,i want to have those values which already exists in picklist values to lookups in existing records as well.....

I have a custom obejct Sales_c in this i have 2 feilds:- 


1> competitor1_c :- Picklist
2> competitor2_c :- Picklist

 

Now, i have created another 2 look-up feilds :-

 

3> Comp1_c : Lookup feild
4> Comp2_c : Lookup feild


Now, i want to capture all picklist feilds(competitor1_c, competitor2_c) values in to look-up feilds (Comp1_c, Comp2_c).

REQUIREMENT :- Need to be able to delete Opportunities via data loader. 
i.e when i'm trying to delete some opportunites through DATA LOADER i'm getting the below ERROR :-


Getting the following message: 
tgrOpportunityBefore: execution of BeforeDelete 
caused by: System.NullPointerException: Attempt to de-reference a null object 
Trigger.tgrOpportunityBefore: line 379, column 1 

 

 

 

TRIGGER :-

 

 // --- This is used since most of the triggers are for Insert and Update on Opportunity.
    if(trigger.isInsert || trigger.isUpdate) {  
      //#101OICD - Variable Declaration -- Start    
      StaticVariables.setAccountDontRun(true); // stop account trigger from running
      List<Id> accIds = new List<Id>();
      Set<id> accidset = new set<id>();
      //#101OICD - Variable Declaration -- End
      
   
 
      //#101OICD -- Loop Through Opp records  and assign values -- Start
      for(Opportunity o:Trigger.new) {
        
        system.debug('Originator EIN ' + o.Originator_EIN__c);
        allCampaignIds.add(o.CampaignId);//CR2180        
        //if(o.Opportunity_Owner_EIN__c == '802558891') o.ABR_Count__c =1;  
        
     
        
        if(o.CloseDate ==null)o.CloseDate = (Date.today()+ 365);
        
        if(o.AccountId != null && o.Auto_Assign_Owner__c)accIds.add(o.accountId);
        
        if(o.OwnerId != null)o.owner__c = o.OwnerId;
        
        //add flag for org to org
        if (
        (o.Routing_Product__c == 'Engage IT' || o.Product_Family__c == 'ENGAGE IT') 
        && o.CreatedDate >= (date.newinstance(2011, 11, 19))  
        //    || ((trigger.newmap.get(o.id).Routing_Product__c != trigger.oldmap.get(o.id).Routing_Product__c)
        //    || (trigger.newmap.get(o.id).Product_Family__c != trigger.oldmap.get(o.id).Product_Family__c ))
        ){
            o.s2s_Link__c = 'BTB to Engage IT';  
        }
        

    //#101OICD -- Part of 101OICD Trigger to Modify Opportunit Owner By Account -- End
     
     //#101OICD -- Part of 101OICD Trigger to Modify Account Information -- Start
        //Added by GS to update account last call date.
        //Update the account last call date field for these accounts      
        list<account> updateCallDate = new list<account>();          
        updateAccountLastContacted updateAccountCallDate = new updateAccountLastContacted();                     
        //updateCallDate = updateAccountCallDate.updateAccount(accidset);
        String objName='Opportunities';
        updateCallDate = updateAccountCallDate.updateAccount(accidset, objName);           
        update updateCallDate;               
    //#101OICD -- Part of 101OICD Trigger to Modify Account Information -- End
    }
     
    //Set RAG Status to None if Leasing History has 0 records -- Start
   LINE 379 :- for(Opportunity o : trigger.new){
    Integer i = [SELECT count() FROM Leasing_History__c WHERE Opportunity__c =: o.Id LIMIT 1];
    if(i < 1){
      o.Finance_Available__c = 'None';
     }
    }    
    //Set RAG Status to None if Leasing History has 0 records -- End   
}

I have a custom object- "TEST" on which i want custom BUTTON-"CMail" on it which will send an email to the owner of that record

===================================================

 

My custom Button CMail:- code

 

{!REQUIRESCRIPT("/soap/ajax/16.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/16.0/apex.js")} 
var ret = sforce.apex.execute("Sendemailbutton" ,"CMail", {}); 
window.location.reload(); 
alert(ret);

 

 

Class:- 

 

global class Sendemailbuttonidepot{

WebService static void UrgetoPSM()
{

test__c con=[Select id,Owner.email,OwnerId from test_c where OwnerId!=null limit 1];
EmailTemplate et=[Select Id,Name,HtmlValue,Encoding,FolderId, Body,Subject From EmailTemplate where name='Salesforce customer' limit 1];
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();

String[] toAddresses = new String[]{'abc@gmail.com'};
//string test=con.Owner.email;
mail.setTargetObjectId(con.OwnerId);
mail.setSubject('User XYZ');
mail.saveAsActivity = false;
mail.setToAddresses(toAddresses);
system.debug('Hanamnth'+mail);
mail.setPlainTextBody('HI we are Testing');
mail.setTemplateId(et.id);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}

 

 

But i'm not able to send the mail to the owner of the record can any1 help me where i'm wrong......

Hi,

 

I have a created a custom button [SEND MAIL] button on the account object to send mail to the owner of the record.

 

Now i want when i click the button and the mail is sent on the click of button then it should get updated in the NOTEs related list(its a visualforce page) like its get updated in the activity history related list.

I have a custom obejct Sales_c in this i have 2 feilds:- 


1> competitor1_c :- Picklist
2> competitor2_c :- Picklist

 

Now, i have created another 2 look-up feilds :-

 

3> Comp1_c : Lookup feild
4> Comp2_c : Lookup feild


Now, i want to capture all picklist feilds(competitor1_c, competitor2_c) values in to look-up feilds (Comp1_c, Comp2_c).

REQUIREMENT :- Need to be able to delete Opportunities via data loader. 
i.e when i'm trying to delete some opportunites through DATA LOADER i'm getting the below ERROR :-


Getting the following message: 
tgrOpportunityBefore: execution of BeforeDelete 
caused by: System.NullPointerException: Attempt to de-reference a null object 
Trigger.tgrOpportunityBefore: line 379, column 1 

 

 

 

TRIGGER :-

 

 // --- This is used since most of the triggers are for Insert and Update on Opportunity.
    if(trigger.isInsert || trigger.isUpdate) {  
      //#101OICD - Variable Declaration -- Start    
      StaticVariables.setAccountDontRun(true); // stop account trigger from running
      List<Id> accIds = new List<Id>();
      Set<id> accidset = new set<id>();
      //#101OICD - Variable Declaration -- End
      
   
 
      //#101OICD -- Loop Through Opp records  and assign values -- Start
      for(Opportunity o:Trigger.new) {
        
        system.debug('Originator EIN ' + o.Originator_EIN__c);
        allCampaignIds.add(o.CampaignId);//CR2180        
        //if(o.Opportunity_Owner_EIN__c == '802558891') o.ABR_Count__c =1;  
        
     
        
        if(o.CloseDate ==null)o.CloseDate = (Date.today()+ 365);
        
        if(o.AccountId != null && o.Auto_Assign_Owner__c)accIds.add(o.accountId);
        
        if(o.OwnerId != null)o.owner__c = o.OwnerId;
        
        //add flag for org to org
        if (
        (o.Routing_Product__c == 'Engage IT' || o.Product_Family__c == 'ENGAGE IT') 
        && o.CreatedDate >= (date.newinstance(2011, 11, 19))  
        //    || ((trigger.newmap.get(o.id).Routing_Product__c != trigger.oldmap.get(o.id).Routing_Product__c)
        //    || (trigger.newmap.get(o.id).Product_Family__c != trigger.oldmap.get(o.id).Product_Family__c ))
        ){
            o.s2s_Link__c = 'BTB to Engage IT';  
        }
        

    //#101OICD -- Part of 101OICD Trigger to Modify Opportunit Owner By Account -- End
     
     //#101OICD -- Part of 101OICD Trigger to Modify Account Information -- Start
        //Added by GS to update account last call date.
        //Update the account last call date field for these accounts      
        list<account> updateCallDate = new list<account>();          
        updateAccountLastContacted updateAccountCallDate = new updateAccountLastContacted();                     
        //updateCallDate = updateAccountCallDate.updateAccount(accidset);
        String objName='Opportunities';
        updateCallDate = updateAccountCallDate.updateAccount(accidset, objName);           
        update updateCallDate;               
    //#101OICD -- Part of 101OICD Trigger to Modify Account Information -- End
    }
     
    //Set RAG Status to None if Leasing History has 0 records -- Start
   LINE 379 :- for(Opportunity o : trigger.new){
    Integer i = [SELECT count() FROM Leasing_History__c WHERE Opportunity__c =: o.Id LIMIT 1];
    if(i < 1){
      o.Finance_Available__c = 'None';
     }
    }    
    //Set RAG Status to None if Leasing History has 0 records -- End   
}