• Simon Whight
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 20
    Replies
One of our dummy users appears to be creating accounts and I need to find out why. The amount of Apex we have is huge and the original developers are long gone.

The Debug log is no use as the 20 processes are quickly eaten up by API. 

I need something that flags to me "user X has created an account because of Trigger Y".

Can you help me at all?

Anyone else encountering this?

I did an update today where I had to limit the batch to 10 (via Dataloader.io) on one object, hitting the same issue on another where I am doing the update with dbAmp.

I have a visualforce email. Due to lots of visibility stuff in the body 1) Outlook looks a bit messy when your forward and it tries to render in the Word engine, 2) the salesforce record for the email looks hideous.

Is there a way to make the email render as PDF and send by any chance?
I have a large VF email. As part of it I have put in some different fonts, also the table has some visibility rules.

When sending the test, it is ignoring the font I have chosen, when forwarding the email on the visibility rules seem to be completely ignored.

Here is the code, apologies for the length. As you can see, just clumps of tables. The Apex Repeat ones have visibility rules in there, the body is meant to make everything send in Calibri. As it stands, it comes through as Times New Roman, plus reply/forward causes a whole host of stuff to be displayed - essentially everything in the Apex Repeat I have asked to be invisible.

Can I get around this? Have I coded this poorly? I needed to do something quickly and without Apex Controllers/VF Components, as such, the solution has to be the same too - I don't have the skills to do that.

Thanks!
 
<messaging:emailTemplate recipientType="User"
  relatedToType="Account"
  subject="Onboarding Email: {!relatedTo.name}"
  replyTo="simonwhight@citation.co.uk">
  <messaging:htmlEmailBody >
    <html>
      <body>
        <STYLE type="text/css">
          CAPTION {font-size: 24px; font-face: CALIBRI }
          TH {font-size: 14px; font-face: CALIBRI; color: #FFFFFF ; font-weight: bold; background: #86878C;
               border-width: 1;  text-align: center }
          TD  {font-size: 12px; font-face: CALIBRI }
          TABLE {border: solid #CCCCCC; border-width: 1}
          TR {border: solid #CCCCCC; border-width: 1}
          P {margin: 0em;}
        </STYLE>
        <font face="CALIBRI" size="2">

<!--Table 1 **************************************************************************************-->
         
   
         <table border="1" width="1200px" >
           <col width="400"/>
           <col width="400"/>
           <col width="400"/>           
           <caption>Client onboarding email for: {!relatedTo.Name}</caption>
          <tr>
           <th>Business Type</th>
           <th>Renewal Type</th>
           <th>Affinity</th>
          </tr>
          <tr>
           <td width="400"/>
           <td width="400"/>
           <td width="400"/>          
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">
            <td align="center">{!ctrtx.Business_Type__c}</td>
            <td align="center">{!ctrtx.Renewal_Type__c}</td>
            <td align="center">{!ctrtx.Affinity__c}</td>
           </tr>
           </apex:repeat> 
        </table>  

        
<!--Table 2 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>      
           <tr>
            <th>Account Name</th>
            <th>Trading As Name</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>              
          <tr>      
            <td align="center">{!relatedTo.name}</td>
            <td align="center">{!relatedTo.Trading_As_Name__c}</td>
          </tr>
        </table>           
          
<!--Table 3 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="1200"/>  
           <tr>
            <th>Address</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>  
          <tr>      
            <td align="center">{!relatedTo.BillingStreet}</td>
          </tr>
          <tr>      
            <td align="center">{!relatedTo.BillingCity}</td>
          </tr>
          <tr>      
            <td align="center">{!relatedTo.BillingState}</td>
          </tr>
          <tr>      
            <td align="center">{!relatedTo.BillingPostalCode}</td>
          </tr>
        </table>           

<!--Table 4 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>      
           <tr>
            <th>Telephone Number</th>
            <th>Website</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <tr>      
            <td align="center">{!relatedTo.phone}</td>
            <td align="center">{!relatedTo.website}</td>
          </tr>
        </table> 
        
<!--Table 5 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>      
           <tr>
            <th>Industry</th>
            <th>Sector</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <tr>      
            <td align="center">{!relatedTo.Industry}</td>
            <td align="center">{!relatedTo.Sector__c}</td>
          </tr>
        </table>         
      
<!--Table 6 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>      
           <tr>
            <th>Total Number Of Employees</th>
            <th>Total Number Of Sites</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <tr>      
            <td align="center">{!FLOOR(relatedTo.Total_Employees__c)}</td>
            <td align="center">{!FLOOR(relatedTo.Sites__c)}</td>
          </tr>
        </table>
        
<!--Table 7 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="400"/>
           <col width="400"/>
           <col width="400"/>        
           <tr>
            <th>FT Employees</th>
            <th>PT Employees</th>
            <th>Subcontractors</th>
          </tr>
          <tr>
           <td width="400"/>
           <td width="400"/>
           <td width="400"/>
          </tr>              
          <tr>      
            <td align="center">{!FLOOR(relatedTo.FT_Employees__c)}</td>
            <td align="center">{!FLOOR(relatedTo.PT_Employees__c)}</td>
            <td align="center">{!FLOOR(relatedTo.Subcontractors__c)}</td>
          </tr>
        </table>                 
      
<!--Table 8 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>
           <caption>Deal Overview</caption>
           <tr>
            <th>Contract Term (months)</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
           <td align="center">{!ctrtx.ContractTerm}</td>
           </tr>
          </apex:repeat> 
        </table>
        
<!--Table 9 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>
           <tr>
            <th>BDM</th>
            <th>Date Signed</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center">{!ctrtx.CompanySigned.Name}</td>
            <td align="center">  <apex:outputText value="{0,date,dd/MM/yyyy}">
                  <apex:param value="{!ctrtx.CompanySignedDate}" /> 
                  </apex:outputText>  </td>
          </tr>
          </apex:repeat> 
        </table>                     
      
<!--Table 10 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>
           <tr>
            <th>Customer Signed By</th>
            <th>Position</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center">{!ctrtx.CustomerSigned.Name}</td>
            <td align="center">{!ctrtx.CustomerSignedTitle}</td>
          </tr>
            </apex:repeat> 
        </table>         
      
<!--Table 11 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>
           <tr>
            <th>Contract Start Date</th>
            <th>Contract End Date</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center">  <apex:outputText value="{0,date,dd/MM/yyyy}">
                  <apex:param value="{!ctrtx.StartDate}" /> 
                  </apex:outputText>  </td>
            <td align="center">  <apex:outputText value="{0,date,dd/MM/yyyy}">
                  <apex:param value="{!ctrtx.EndDate}" /> 
                  </apex:outputText>  </td>
          </tr>
            </apex:repeat> 
        </table> 
        
<!--Table 12 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>
           <caption>Services Purchased</caption>           
           <tr>
            <th>EL&amp;HR</th>
            <th>H&amp;S</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center">{!IF(ctrtx.Services_Taken_EL__c=TRUE,"Yes","No")}</td>            
            <td align="center">{!IF(ctrtx.Services_Taken_HS__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table>                 
      
<!--Table 13 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>       
           <tr>
            <th>A&amp;I only EL&amp;HR</th>
            <th>A&amp;I only H&amp;S</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">        
            <td align="center">{!IF(ctrtx.Services_Taken_AI_Only__c=TRUE,"Yes","No")}</td>            
            <td align="center">{!IF(ctrtx.Services_Taken_AI_Only_HS__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table>       

<!--Table 14 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>       
           <tr>
            <th>Advice Only EL&amp;HR</th>
            <th>Advice Only H&amp;S</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center">{!IF(ctrtx.Services_Taken_Advice_Only__c=TRUE,"Yes","No")}</td>            
            <td align="center">{!IF(ctrtx.Services_Taken_Advice_Only_HS__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat>           
        </table>      
      
<!--Table 15 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>       
           <tr>
            <th>Small Business Package</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center">{!IF(ctrtx.Services_Taken_SBP__c=TRUE,"Yes","No")}</td>            
          </tr>
            </apex:repeat> 
        </table> 
        
<!--Table 16 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/> 
           <caption>Other Service</caption>        
           <tr>
            <th>JIT Tribunal</th>
            <th>Fire Risk Assessments</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>            
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">     
            <td align="center">{!IF(ctrtx.Services_Taken_JIT__c=TRUE,"Yes","No")}</td>            
            <td align="center">{!IF(ctrtx.Services_Taken_FRA__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table> 

<!--Table 17 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>      
           <tr>
            <th>Training</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center">{!IF(ctrtx.Services_Taken_Training__c=TRUE,"Yes","No")}</td>            
          </tr>
            </apex:repeat> 
        </table> 
        
<!--Table 18 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>      
           <tr>
            <th>Consultancy</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center">{!IF(ctrtx.Services_Taken_Consultancy__c=TRUE,"Yes","No")}</td>            
          </tr>
            </apex:repeat> 
        </table>         
      
<!--Table 19 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>       
           <tr>
            <th></th>
            <th>Business Defence</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>            
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center"></td>            
            <td align="center">{!IF(ctrtx.Business_Defence__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table> 
      
<!--Table 20 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>       
           <tr>
            <th></th>
            <th>Environmental</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center"></td>            
            <td align="center">{!IF(ctrtx.Services_Taken_Env__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table> 

<!--Table 21 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>       
           <tr>
            <th></th>
            <th>eRAMS</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center"></td>            
            <td align="center">{!IF(ctrtx.Services_Taken_eRAMS__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table> 
        
<!--Table 22 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>
           <caption>Terms &amp; Sales Notes</caption>        
           <tr>
            <th>Finance Notes</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">        
            <td align="center">{!ctrtx.Finance_Notes__c}</td>            
          </tr>
            </apex:repeat> 
        </table> 

<!--Table 23 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>     
           <tr>
            <th>Special Terms</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center">{!ctrtx.SpecialTerms}</td>            
          </tr>
            </apex:repeat> 
        </table> 
        
<!--Table 24 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>     
           <tr>
            <th>EL&amp;HR Notes</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">      
            <td align="center">{!ctrtx.PEL_Notes__c}</td>            
          </tr>
            </apex:repeat> 
        </table>    
        
<!--Table 25 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>     
           <tr>
            <th>H&amp;S Notes</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center">{!ctrtx.H_S_Notes__c}</td>            
          </tr>
            </apex:repeat> 
        </table>  
        
<!--Table 26 **************************************************************************************-->
         
          <table border="1" width="1200px" >
           <col width="65"/>
           <col width="240"/>
           <col width="240"/>           
           <col width="240"/>
           <col width="220"/>
           <col width="65"/>           
           <col width="65"/>   
           <col width="65"/>  
           <caption>Contacts and Users</caption>
           <tr>
            <th>Salutation</th>
            <th>Name</th>
            <th>Job Title</th>
            <th>Email Address</th>
            <th>Telephone No</th>
            <th>Super?</th>
            <th>EL&amp;HR?</th>
            <th>H&amp;S?</th>
          </tr>
          <tr>
           <td width="65"/>
           <td width="240"/>
           <td width="240"/>           
           <td width="240"/>
           <td width="220"/>
           <td width="65"/>           
           <td width="65"/>   
           <td width="65"/> 
          </tr>
        <apex:repeat var="conx" value="{!relatedTo.Contacts}">  
          <tr>
            <td align="center">{!conx.Salutation}</td>
            <td align="center">{!conx.Name}</td>
            <td align="center">{!conx.Title}</td>
            <td align="center">{!conx.email}</td>
            <td align="center">{!conx.phone}</td>
            <td align="center">{!conx.Online_Super_User__c}</td>
            <td align="center">{!conx.Helpline_PEL__c}</td>
            <td align="center">{!conx.Helpline_H_S__c}</td>
          </tr>
        </apex:repeat> 
        </table>               
      
<!--Table 27 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="200"/>
           <col width="200"/>
           <col width="200"/>  
           <col width="200"/>
           <col width="200"/>
           <col width="200"/>
           <caption>Sites</caption>
           <tr>
            <th>Street</th>
            <th>City</th>
            <th>County</th>
            <th>Postcode</th>
            <th>Telephone No</th>
            <th>Site Type</th>
          </tr>
          <tr>
           <td width="200"/>
           <td width="200"/>
           <td width="200"/>  
           <td width="200"/>
           <td width="200"/>
           <td width="200"/>
          </tr>
        <apex:repeat var="sitex" value="{!relatedTo.Sites__r}">  
          <tr>
            <td align="center">{!sitex.Street__c}</td>
            <td align="center">{!sitex.City__c}</td>
            <td align="center">{!sitex.County__c}</td>
            <td align="center">{!sitex.Postcode__c}</td>
            <td align="center">{!sitex.Phone__c}</td>
            <td align="center">{!sitex.Site_Type__c}</td>
          </tr>
        </apex:repeat> 
        </table> 
      
        </font>
      </body>
    </html>
  </messaging:htmlEmailBody>
 </messaging:emailTemplate>

 
At the moment, I'm trying to "hello world" this component to put into a VF email. I am massively struggling though.

Here is what I have. First the Apex - this is to get the Contract whose detail is needed, the ID I am planning to get from the Contract record where the "Send Email" button will be hosted:
public class findContract {
  
public Id conID {get; set;}

    Public List<Contract> currentcontract = new List<Contract>();

    public List<Contract> findCurrentContract() {
        currentcontract = [SELECT Id, StartDate, Business_Type__c, Affinity__c, ContractTerm,  CompanySigned.name, CompanySignedDate, CustomerSigned.name, CustomerSignedDate, CustomerSignedTitle, 
        EndDate, Services_Taken_AI_Only__c, Services_Taken_AI_Only_HS__c, Services_Taken_Advice_Only__c, Services_Taken_Advice_Only_HS__c, Services_Taken_Franchise_Comp_EL__c, 
        Services_Taken_Franchise_Comp_HS__c, Services_Taken_Consultancy__c, Services_Taken_Franchise_Entry_EL__c, Services_Taken_Env__c, 
        Services_Taken_eRAMS__c, Services_Taken_FRA__c, Services_Taken_HS__c, Services_Taken_SBP__c, Services_Taken_Training__c, Services_Taken_JIT__c, H_S_Notes__c, 
        Finance_Notes__c, PEL_Notes__c, SpecialTerms FROM Contract WHERE Id = :conID];   
          

        return currentcontract ;
        
        }
    
}
Then we have the Component, currently this will not save with this error ( Error: Could not resolve the entity from <apex:outputField> value binding '{!con.ContractTerm}'. <apex:outputField> can only be used with SObjects, or objects that are Visualforce field component resolvable. )

I'm just trying to get an example 4 fields to put into the component!

I haven't got as far as putting the component in the VF email because I can't do the above. I'm expecting to have something like:
 
<c:DisplayContractDetails ContractID="{!Contract.Id}"/> 

*** I'm assuming I'll have to do something a bit more advanced to pull the current records id

I can see what I am trying to do logically, my skills are letting me down. Can anyone help?

Thanks and Happy New Year!


 

I have a button on an contract record. When pressed, it will fire off a Visualforce Email to some internal email addresses. The email setup has a relatedtoType of Account which allows me to pull in the information I need from the related objects.

Where I am struggling is that the technique of Apex Repeat cannot guarantee it will pull in the latest Contract when run. So I need a custom controller to pull back the correct Contract information for my email - essentially the record where the button was pressed.

So far, I have the controller with all my vital data for my email:
 

public class findContract {
   
public String conID {get; set;}

    private final List<Contract> contracts;

    public findContract() {
        contracts= [SELECT Id, StartDate, Business_Type__c, Affinity__c, ContractTerm,  CompanySigned.name, CompanySignedDate, CustomerSigned.name, CustomerSignedDate, CustomerSignedTitle, 
        EndDate, Services_Taken_AI_Only__c, Services_Taken_AI_Only_HS__c, Services_Taken_Advice_Only__c, Services_Taken_Advice_Only_HS__c, Services_Taken_Franchise_Comp_EL__c, 
        Services_Taken_Franchise_Comp_HS__c, Services_Taken_Consultancy__c, Services_Taken_Franchise_Entry_EL__c, Services_Taken_Env__c, 
        Services_Taken_eRAMS__c, Services_Taken_FRA__c, Services_Taken_HS__c, Services_Taken_SBP__c, Services_Taken_Training__c, Services_Taken_JIT__c, H_S_Notes__c, 
        Finance_Notes__c, PEL_Notes__c, SpecialTerms FROM Contract WHERE Id = :conID LIMIT 1];   
          }

    public List<Contract> getContract() {
        return contracts;
    }
}
Now I need assistance with the Component and referencing it in the email.

Obviously, I need the Component to pick off the record ID where the my send email button is hosted to populate conID for the SOQL, so there is that element.

Also, the results of the query are displayed in a sequence of stacked fixed width tables like this:
 
<!--Table 9 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>
           <tr>
            <th>BDM</th>
            <th>Date Signed</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <tr>
            <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}" rows="1">          
            <td align="center">{!ctrtx.CompanySigned.Name}</td>
            <td align="center">  <apex:outputText value="{0,date,dd/MM/yyyy}">
                  <apex:param value="{!ctrtx.CompanySignedDate}" /> 
                  </apex:outputText>  </td>
            </apex:repeat> 
          </tr>
        </table>

So I need a way of breaking up the information and mimicking that style. So a big list of tables in the Component.

Can anyone help?

Could someone give me a hand with this?

I have a Visualforce Email that has a table bringing back a load of data from an Apex Repeat. The table is quite wide due to it bringing back a lot of checkboxes. 

I would like columns to be suppressed if all the entries returned at "No" - i.e. unchecked.
 

I know you can do some variable visibility stuff with Java/jquery but have no idea where to start.

I'm trying to avoid using a controller and extension to make a Visualforce template.

What I'd like to do is use some JavaScript to determine what the Apex Repeat displays, ideally only returning the fields for the Contract object the button that will run the email is located in (The relatedtotype is pointing at Account and I can't get around that).

Is this at all possible?

I've been fumbling around but I am in no way Javascript proficient. Can't even get a whole load of results to display, let alone refine by a Contract Name or similar.

This is what I've been doing 
<!--Table 8 **************************************************************************************-->
         
         <table border="0" width="1200px" >
           <col width="1200"/>
           <caption>Deal Overview</caption>
           <tr>
            <th>Contract Term (months)</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <tr>
   <td>       
  <script type="text/javascript">
      var contract = [];
            <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">        
            Contract.push(ContractTerm : "{!ctrtx.ContractTerm}",
            ContractNumber : "{!ctrtx.ContractNumber}")
            </apex:repeat> 

      contract.ContractTerm;      
    </script></td>
          </tr>
        </table>

I'd hope to whittle down the ContractTerm to the particular one of the contract record where my button is located.
Is there a way to force Salesforce to edit all Active Contract records?

I have a need for an Apex trigger to run when a certain date is hit, however it will be unlikely that the record will be updated when that date is hit (so no Update or Edit) and the date with which to run the trigger will be variable (so no pre-determined time delay of X months).

 
Hi. Fingers crossed this is simple.

I've made an email, it uses Account as the RelatedToType as it needs to source information from Contacts and Contracts. I had been using a Repeater to pull information from Contracts with a row limit of 1. What has transpired is that I cannot control the order in which information returns from the Repeater. I need the latest record, it will return whatever it has decided to pull back.

The result is that I need a controller to pull Contract information. This, right here, is where I am asking you for help. I haven't got a clue. 

It's not overly complex I would assume, just the latest related Contract record to the Account, and then a bit of guidance on how I replace the references to the repeater with the controller.

Thanks!
<!--Table 27 **************************************************************************************-->
         
         <table border="0" >
           <col width="150"/>
           <col width="150"/>
           <col width="150"/>           
           <col width="150"/>
           <col width="150"/>   
           <col width="150"/>  
           <caption>Contacts and Users</caption>
           <tr>
            <th>Street</th>
            <th>City</th>
            <th>County</th>
            <th>Postcode</th>
            <th>Telephone No</th>
            <th>Site Type</th>
          </tr>
        <apex:repeat var="sitex" value="{!relatedTo.Site}">  
          <tr>
            <td>{!sitex.Street__c}</td>
            <td>{!sitex.City__c}</td>
            <td>{!sitex.County__c}</td>
            <td>{!sitex.Postcode__c}</td>
            <td>{!sitex.phone}</td>
            <td>{!sitex.Site_Type__c}</td>
          </tr>
        </apex:repeat> 
        </table>

The above is causing this error: [Error] Error: Unknown property 'String.Street__c'.

Assuming I need something there to drag street name out of the error appropriately. Can someone assist with the syntax?

Thanks
As stated, I'm trying to pull a user and customer name and I'm getting the 15 character ID back instead. How do I get the actual name?

Code snippet:
 
<!--Table 10 **************************************************************************************-->
         
         <table border="0" >
           <col width="450"/>
           <col width="450"/>
           <tr>
            <th>Customer Signed By</th>
            <th>Position</th>
          </tr>
          <tr>
            <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}" rows="1">          
            <td>{!ctrtx.CustomerSigned}</td>
            <td>{!ctrtx.CustomerSignedTitle}</td>
            </apex:repeat> 
          </tr>
        </table>

 
I thought I'd see if I could speak to one of our bespoke systems in my company via External Objects. When attempting to do the setup, I only have Simple URL as an option, whereas all the videos have things like OAuth etc. Why am I missing these options? Not much in the way of help for doing such a thing online.
I was going to make an Apex trigger as part of sorting out our company's workflow. With the advent of Process Builder, doing workflow is now in the remit of click to create.

However, one of the things I want to do isn't possible. It still requires a trigger. It is purely an action: send an email to all related contacts on a Contract via the Account.

Why, when making a Publisher Action, do you need a Visualforce Page? I understand you need it for something that is a bit more visual, where you action then needs to go to a page requiring user input, but I simply want something to happen. Can you bypass the VisualForce aspect of this somehow?
Sometimes you can have too much information. In the huge spread of documentation on Lightning, I cannot answer whether or not I can do "this thing".

I would love to digitise our company's account cards. Little bit of plastic that just have a name and a number on them plus some branding.

I thought, why not quickly knock this up in Lightning. Except there is one piece of information I cannot quite fathom. How on earth do you get app you create into the hands of your clients? Is it actually possible?
Hi,

Hoping this is a relatively easy query. I'm hoping to make a trigger that will send an email to all related Contacts (related on Account) on a Contract. 

Essentially, it is an anniversary catch up: Contract Start Date + X days/months/years = designated milestone then send email based on email template to all Contacts.

Can anyone help me out on this?

Thanks,
I know why it is happening, my array is empty. What I want to be able to do is provide a logica error for the end user, not a browser parped javascript technical error bubble.

Here is the code:

result1 = sforce.connection.query("SELECT ContractNumber FROM Contract where Id = \'" + idToUse + "\'");

records1 = result1.getArray("records");

for (var i = 0; i < records1.length; i++) {
    var record1 = records1[i];
    contrId1 = record1.ContractNumber.substring(0, 15);
}
The SoQL will occasionally be empty, so I need to flag some sort of "please make sure Contract Number has been entered" and exit the code. Can anyone help?

Hi,

As a complete Javascript novice, I'm trying to get some assistance here with a script to run a report from a button on the Contracts object that will parse some field data to a joined report. You can't do it with a URL hack, has to be javascript.

Luckily, I have some code to work from, it is rather transparent although I need some help amending it.

My issue is with pulling some information from Salesforce into the script, arrays and such things.
 

Essentially the code I have ripped is looking to parse one field, I am looking to parse two (a custom field from the Accounts object (sagecode__c for arguments sake) and one from the Contracts object itself (contractnumber__c for arguments sake).

This is the code, it is from the author so does not contain anything pertaining to what I am aiming to do in my own org. The header comments are mine.

// JScript source code
// This is a script which parses parameters to a Joined Report as URL hacking will not work in this instance.
// Background reading on solution is here: http://salesforce.stackexchange.com/questions/8723/passing-variables-to-joined-reports
// This script was sourced from here: https://gist.github.com/stephenbrown1/7443749
// Chrome extention tools to debug the report from here: http://forums.chrispederick.com/
// -- -- -- Click FORMS and VIEW FORM INFORMATION to find the reportJson details for this script after running report.
// This site URL encodes the JSON request: http://www.freeformatter.com/url-encoder.html
// Code is annotated where you need to make amendments

var url = "/00O90000004ewmO";    // report ID
var method = "POST";
var idArray = {!GETRECORDIDS($ObjectType.Contract_Partner_vod__c)};   // if the field you want for report critiera isn't avail from the detail record (ie list button) then need to get related data
var idToUse = idArray[0];

//alert(idToUse);

if (idToUse == null) {   // need to have at least 1 record selected
alert('You must select one contract partner record to run this report.');
} else {

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

result = sforce.connection.query("Select Id, Contract_vod__c from Contract_Partner_vod__c where Id = \'" + idToUse + "\'");

var contrId = null;

records = result.getArray("records");

for (var i=0; i< records.length; i++) {
var record = records[i];
contrId = record.Contract_vod__c.substring(0,15);
}

//alert(contrId);

// if the field you want for report critiera isn't avail from the detail record (ie list button) then need to get related data - in this case contract ID

// next line is post data - needs to be URL encoded. Note this is based on what comes from the runReportJson which you can get from running the report and checking firebug
var postData = "op=run&runReportJson=%7B%22last_modified_user_id%22%3A%22005900000022hZg%22%2C%22breaks%22%3A%5B%7B%22brkcol%22%3A%2200N90000007QeT8%22%2C%22break%22%3A%2200N90000007QeT8%22%2C%22sortColumn%22%3A%2200N90000007QeT8%22%2C%22brkord%22%3A%22up%22%2C%22breakLevel%22%3A%220%22%2C%22brkdat%22%3A%220%22%7D%5D%2C%22colorRanges%22%3A%5B%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22reln%22%3A%2200N90000007JDQt%22%2C%22currency%22%3A%22000%22%2C%22id%22%3A%2200O90000004ewmO%22%2C%22cust_devName%22%3A%22Contract_Price_List%22%2C%22cust_name%22%3A%22Contract+Price+List%22%2C%22last_modified_by%22%3A%22Paul+Hosking%22%2C%22details%22%3A%22no%22%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22lsk%22%2C%22value%22%3A%221%22%7D%2C%7B%22param%22%3A%22block_id_counter%22%2C%22value%22%3A%226%22%7D%5D%2C%22templateKey%22%3A%2201I900000018lXc00N90000007JDQt%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%5D%2C%22sortdir%22%3A%22down%22%2C%22sideBySide%22%3Afalse%2C%22blocks%22%3A%5B%7B%22templateKey%22%3A%2201I900000018lXc00N90000007JDQt%22%2C%22scope%22%3A%22organization%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%22FK_NAME%22%2C%22CUST_NAME%22%2C%2200N90000007QeUH%22%2C%2200N90000007QeT7%22%5D%2C%22last_modified_user_id%22%3A%22%22%2C%22sideBySide%22%3Afalse%2C%22sortdir%22%3A%22up%22%2C%22breaks%22%3A%5B%5D%2C%22a%22%3A%5B%2200N90000007QeT7%22%2C%2200N90000007QeUH%22%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22colorRanges%22%3A%5B%5D%2C%22reln%22%3A%2200N90000007JDQt%22%2C%22format%22%3A%22t%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22v%22%3A142%2C%22cust_name%22%3A%22Contract+Price+Rule%22%2C%22co%22%3A%22no%22%2C%22last_modified_date%22%3A%22%22%2C%22last_modified_by%22%3A%22%22%2C%22details%22%3A%22no%22%2C%22customAggregates%22%3A%5B%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%2C%22blockId%22%3A%22B1%22%2C%22csfReferences%22%3A%5B%22FORMULA1%22%2C%22FORMULA2%22%2C%22FORMULA3%22%2C%22FORMULA4%22%2C%22FORMULA5%22%2C%22FORMULA6%22%2C%22FORMULA7%22%5D%7D%2C%22rt%22%3A%2251%22%2C%22filters%22%3A%5B%7B%22pc%22%3A%22FK_CUSTENT_ID%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22" + contrId + "%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%5D%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22colDt_c%22%2C%22value%22%3A%2200N90000007QeY2%22%7D%2C%7B%22param%22%3A%22colDt_e%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22colDt_q%22%2C%22value%22%3A%22custom%22%7D%2C%7B%22param%22%3A%22colDt_s%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22function%22%2C%22value%22%3A%22c%22%7D%2C%7B%22param%22%3A%22name_op%22%2C%22value%22%3A%22co%22%7D%2C%7B%22param%22%3A%22save_drill%22%2C%22value%22%3A%22true%22%7D%5D%7D%2C%7B%22templateKey%22%3A%2201I900000018lXc%22%2C%22scope%22%3A%22organization%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%22CUST_NAME%22%2C%2200N90000007QeT6%22%5D%2C%22last_modified_user_id%22%3A%22%22%2C%22breaks%22%3A%5B%5D%2C%22sideBySide%22%3Afalse%2C%22sortdir%22%3A%22up%22%2C%22a%22%3A%5B%2200N90000007QeT6%22%5D%2C%22colorRanges%22%3A%5B%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22format%22%3A%22t%22%2C%22v%22%3A142%2C%22cust_name%22%3A%22List+Price%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22last_modified_date%22%3A%22%22%2C%22co%22%3A%22no%22%2C%22last_modified_by%22%3A%22%22%2C%22details%22%3A%22no%22%2C%22customAggregates%22%3A%5B%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%2C%22blockId%22%3A%22B0%22%7D%2C%22rt%22%3A%2251%22%2C%22filters%22%3A%5B%7B%22pc%22%3A%22CUST_RECORDTYPE%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22List_Price_Rule_vod%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeUG%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeT2%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeT1%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%5D%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22colDt_c%22%2C%22value%22%3A%2200N90000007QeY2%22%7D%2C%7B%22param%22%3A%22colDt_e%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22colDt_q%22%2C%22value%22%3A%22custom%22%7D%2C%7B%22param%22%3A%22colDt_s%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22function%22%2C%22value%22%3A%22c%22%7D%2C%7B%22param%22%3A%22name_op%22%2C%22value%22%3A%22co%22%7D%5D%7D%2C%7B%22templateKey%22%3A%2201I900000018lXc%22%2C%22scope%22%3A%22organization%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%22CUST_NAME%22%2C%2200N90000007QeUH%22%2C%2200N90000007QeT7%22%5D%2C%22last_modified_user_id%22%3A%22%22%2C%22breaks%22%3A%5B%5D%2C%22sideBySide%22%3Afalse%2C%22sortdir%22%3A%22up%22%2C%22colorRanges%22%3A%5B%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22format%22%3A%22t%22%2C%22v%22%3A142%2C%22cust_name%22%3A%22STT+Price%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22last_modified_date%22%3A%22%22%2C%22co%22%3A%22no%22%2C%22last_modified_by%22%3A%22%22%2C%22details%22%3A%22no%22%2C%22customAggregates%22%3A%5B%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%2C%22blockId%22%3A%22B3%22%7D%2C%22rt%22%3A%2251%22%2C%22filters%22%3A%5B%7B%22pc%22%3A%2200N90000007QeT2%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeT1%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007JDQt%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeUG%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeY2%22%2C%22pn%22%3A%22ge%22%2C%22pv%22%3A%22TODAY%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeTC%22%2C%22pn%22%3A%22le%22%2C%22pv%22%3A%22TODAY%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%22CUST_RECORDTYPE%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22Discount_Rule_vod%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%5D%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22colDt_c%22%2C%22value%22%3A%2200N90000007QeY2%22%7D%2C%7B%22param%22%3A%22colDt_e%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22colDt_q%22%2C%22value%22%3A%22custom%22%7D%2C%7B%22param%22%3A%22colDt_s%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22function%22%2C%22value%22%3A%22c%22%7D%2C%7B%22param%22%3A%22name_op%22%2C%22value%22%3A%22co%22%7D%5D%7D%5D%2C%22format%22%3A%22mb%22%2C%22created_by_user_id%22%3A%22005900000022hZg%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22v%22%3A142%2C%22last_modified_date%22%3A%2214%2F11%2F2013+9%3A49+AM%22%2C%22co%22%3A%22yes%22%2C%22customAggregates%22%3A%5B%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22List+Price+List+Price%22%2C%22DeveloperName%22%3A%22FORMULA1%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22STT+Disc%22%2C%22DeveloperName%22%3A%22FORMULA2%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22STT+Net%22%2C%22DeveloperName%22%3A%22FORMULA3%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22STT+Disc+Net+Price%22%2C%22DeveloperName%22%3A%22FORMULA4%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22Contract+Disc+Net+Price%22%2C%22DeveloperName%22%3A%22FORMULA5%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22IF%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%3C%3E0%5Cn%2C+B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%5Cn%2C+IF%28B1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%3C%3E0%5Cn%2C%28B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+B1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%29+%2F+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%3C%3E0%5Cn%2CB3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%3C%3E0%5Cn%2C+%28B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%29%2FB0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%5Cn%2C0%5Cn%29%29%29%29%22%2C%22DataType%22%3A%22P%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22Final+Discount%22%2C%22DeveloperName%22%3A%22FORMULA6%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22IF%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+%3C%3E+0%5Cn%2C+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%5Cn%2C+IF%28B1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG+%3C%3E+0%5Cn%2CB1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+%3C%3E+0%5Cn%2CB0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG+%3C%3E+0%5Cn%2CB3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%5Cn%2CB0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%5Cn%29%29%29%29%22%2C%22DataType%22%3A%22C%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22Final+Net%22%2C%22DeveloperName%22%3A%22FORMULA7%22%2C%22Scale%22%3A2%7D%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%7D%2C%22rt%22%3A%2251%22%2C%22cust_owner%22%3A%2200D90000000ome4%22%7D&repId=00O90000004ewmO";

// You REALLY want async = true.
// Otherwise, it'll block ALL execution waiting for server response.
var async = true;

var request = new XMLHttpRequest();




// Before we send anything, we first have to say what we will do when the
// server responds. This seems backwards (say how we'll respond before we send
// the request? huh?), but that's how Javascript works.
// This function attached to the XMLHttpRequest "onload" property specifies how
// the HTTP response will be handled.
request.onload = function () {

// Because of javascript's fabulous closure concept, the XMLHttpRequest "request"
// object declared above is available in this function even though this function
// executes long after the request is sent and long after this function is
// instantiated. This fact is CRUCIAL to the workings of XHR in ordinary
// applications.

// You can get all kinds of information about the HTTP response.

var status = request.status; // HTTP response status, e.g., 200 for "200 OK"
var data = request.responseText; // Returned data, e.g., an HTML document.
var x=window.open().document;
x.open();
x.write(data);
x.close();

}

request.open(method, url, async);

request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
// Or... request.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
// Or... whatever

// Actually sends the request to the server.
request.send(postData);
}
I can see what is going on, array is being created, SoQL query executing, value being stored. But there are some elements I am not sure of:

var idArray = {!GETRECORDIDS($ObjectType.Contract_Partner_vod__c)};   // if the field you want for report critiera isn't avail from the detail record (ie list button) then need to get

Unsure of the syntax I use here. I'm obviously to get ID's from an object to use in a query, I just need to know if I'm going to be formatting it correctly. I would ask our Java guys but I think this falls into the realm of Salesforce syntax.

records = result.getArray("records");

for (var i=0; i< records.length; i++) {
var record = records[i];
contrId = record.Contract_vod__c.substring(0,15);
}

Not sure what this piece of the code is aiming to do either. Is it truncating the 18 character ID? Because if so, I can probably kill this section of code off as I will be purely dealing with strings.



The rest seems relatively straightforward, it looks like I would have to duplicate the code to find my second field to parse. This person is obviously looking for his one custom field to parse to the report, as reflected by the search and result obtained.

Can anyone shed some light here to help me through?

Thanks.
Following Twitter Widget Code is not being rendered on the VF Page - Appreciate a fix for this issue asap :

<apex:page standardcontroller="Competitor__c" > <script src="http://widgets.twimg.com/j/2/widget.js"></script> <script> new TWTR.Widget({ version: 2, type: 'search', search: '{!Competitor__c.Name}', interval: 6000, title: '', subject:'', width: 'auto', height: 200, theme: { shell: { background: '#ffffff', color: '#ffffff' }, tweets: { background: '#ffffff', color: '#000000', links: '#1797C0' } }, features: { scrollbar: false, loop: true, live: true, hashtags: true, timestamp: true, avatars: true, toptweets: true, behavior: 'default' } }).render().start(); </script> </apex:page>
I have a large VF email. As part of it I have put in some different fonts, also the table has some visibility rules.

When sending the test, it is ignoring the font I have chosen, when forwarding the email on the visibility rules seem to be completely ignored.

Here is the code, apologies for the length. As you can see, just clumps of tables. The Apex Repeat ones have visibility rules in there, the body is meant to make everything send in Calibri. As it stands, it comes through as Times New Roman, plus reply/forward causes a whole host of stuff to be displayed - essentially everything in the Apex Repeat I have asked to be invisible.

Can I get around this? Have I coded this poorly? I needed to do something quickly and without Apex Controllers/VF Components, as such, the solution has to be the same too - I don't have the skills to do that.

Thanks!
 
<messaging:emailTemplate recipientType="User"
  relatedToType="Account"
  subject="Onboarding Email: {!relatedTo.name}"
  replyTo="simonwhight@citation.co.uk">
  <messaging:htmlEmailBody >
    <html>
      <body>
        <STYLE type="text/css">
          CAPTION {font-size: 24px; font-face: CALIBRI }
          TH {font-size: 14px; font-face: CALIBRI; color: #FFFFFF ; font-weight: bold; background: #86878C;
               border-width: 1;  text-align: center }
          TD  {font-size: 12px; font-face: CALIBRI }
          TABLE {border: solid #CCCCCC; border-width: 1}
          TR {border: solid #CCCCCC; border-width: 1}
          P {margin: 0em;}
        </STYLE>
        <font face="CALIBRI" size="2">

<!--Table 1 **************************************************************************************-->
         
   
         <table border="1" width="1200px" >
           <col width="400"/>
           <col width="400"/>
           <col width="400"/>           
           <caption>Client onboarding email for: {!relatedTo.Name}</caption>
          <tr>
           <th>Business Type</th>
           <th>Renewal Type</th>
           <th>Affinity</th>
          </tr>
          <tr>
           <td width="400"/>
           <td width="400"/>
           <td width="400"/>          
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">
            <td align="center">{!ctrtx.Business_Type__c}</td>
            <td align="center">{!ctrtx.Renewal_Type__c}</td>
            <td align="center">{!ctrtx.Affinity__c}</td>
           </tr>
           </apex:repeat> 
        </table>  

        
<!--Table 2 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>      
           <tr>
            <th>Account Name</th>
            <th>Trading As Name</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>              
          <tr>      
            <td align="center">{!relatedTo.name}</td>
            <td align="center">{!relatedTo.Trading_As_Name__c}</td>
          </tr>
        </table>           
          
<!--Table 3 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="1200"/>  
           <tr>
            <th>Address</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>  
          <tr>      
            <td align="center">{!relatedTo.BillingStreet}</td>
          </tr>
          <tr>      
            <td align="center">{!relatedTo.BillingCity}</td>
          </tr>
          <tr>      
            <td align="center">{!relatedTo.BillingState}</td>
          </tr>
          <tr>      
            <td align="center">{!relatedTo.BillingPostalCode}</td>
          </tr>
        </table>           

<!--Table 4 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>      
           <tr>
            <th>Telephone Number</th>
            <th>Website</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <tr>      
            <td align="center">{!relatedTo.phone}</td>
            <td align="center">{!relatedTo.website}</td>
          </tr>
        </table> 
        
<!--Table 5 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>      
           <tr>
            <th>Industry</th>
            <th>Sector</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <tr>      
            <td align="center">{!relatedTo.Industry}</td>
            <td align="center">{!relatedTo.Sector__c}</td>
          </tr>
        </table>         
      
<!--Table 6 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>      
           <tr>
            <th>Total Number Of Employees</th>
            <th>Total Number Of Sites</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <tr>      
            <td align="center">{!FLOOR(relatedTo.Total_Employees__c)}</td>
            <td align="center">{!FLOOR(relatedTo.Sites__c)}</td>
          </tr>
        </table>
        
<!--Table 7 **************************************************************************************-->  
        
         <table border="1" width="1200px" >
           <col width="400"/>
           <col width="400"/>
           <col width="400"/>        
           <tr>
            <th>FT Employees</th>
            <th>PT Employees</th>
            <th>Subcontractors</th>
          </tr>
          <tr>
           <td width="400"/>
           <td width="400"/>
           <td width="400"/>
          </tr>              
          <tr>      
            <td align="center">{!FLOOR(relatedTo.FT_Employees__c)}</td>
            <td align="center">{!FLOOR(relatedTo.PT_Employees__c)}</td>
            <td align="center">{!FLOOR(relatedTo.Subcontractors__c)}</td>
          </tr>
        </table>                 
      
<!--Table 8 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>
           <caption>Deal Overview</caption>
           <tr>
            <th>Contract Term (months)</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
           <td align="center">{!ctrtx.ContractTerm}</td>
           </tr>
          </apex:repeat> 
        </table>
        
<!--Table 9 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>
           <tr>
            <th>BDM</th>
            <th>Date Signed</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center">{!ctrtx.CompanySigned.Name}</td>
            <td align="center">  <apex:outputText value="{0,date,dd/MM/yyyy}">
                  <apex:param value="{!ctrtx.CompanySignedDate}" /> 
                  </apex:outputText>  </td>
          </tr>
          </apex:repeat> 
        </table>                     
      
<!--Table 10 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>
           <tr>
            <th>Customer Signed By</th>
            <th>Position</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center">{!ctrtx.CustomerSigned.Name}</td>
            <td align="center">{!ctrtx.CustomerSignedTitle}</td>
          </tr>
            </apex:repeat> 
        </table>         
      
<!--Table 11 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>
           <tr>
            <th>Contract Start Date</th>
            <th>Contract End Date</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center">  <apex:outputText value="{0,date,dd/MM/yyyy}">
                  <apex:param value="{!ctrtx.StartDate}" /> 
                  </apex:outputText>  </td>
            <td align="center">  <apex:outputText value="{0,date,dd/MM/yyyy}">
                  <apex:param value="{!ctrtx.EndDate}" /> 
                  </apex:outputText>  </td>
          </tr>
            </apex:repeat> 
        </table> 
        
<!--Table 12 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>
           <caption>Services Purchased</caption>           
           <tr>
            <th>EL&amp;HR</th>
            <th>H&amp;S</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center">{!IF(ctrtx.Services_Taken_EL__c=TRUE,"Yes","No")}</td>            
            <td align="center">{!IF(ctrtx.Services_Taken_HS__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table>                 
      
<!--Table 13 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>       
           <tr>
            <th>A&amp;I only EL&amp;HR</th>
            <th>A&amp;I only H&amp;S</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">        
            <td align="center">{!IF(ctrtx.Services_Taken_AI_Only__c=TRUE,"Yes","No")}</td>            
            <td align="center">{!IF(ctrtx.Services_Taken_AI_Only_HS__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table>       

<!--Table 14 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>       
           <tr>
            <th>Advice Only EL&amp;HR</th>
            <th>Advice Only H&amp;S</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center">{!IF(ctrtx.Services_Taken_Advice_Only__c=TRUE,"Yes","No")}</td>            
            <td align="center">{!IF(ctrtx.Services_Taken_Advice_Only_HS__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat>           
        </table>      
      
<!--Table 15 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>       
           <tr>
            <th>Small Business Package</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center">{!IF(ctrtx.Services_Taken_SBP__c=TRUE,"Yes","No")}</td>            
          </tr>
            </apex:repeat> 
        </table> 
        
<!--Table 16 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/> 
           <caption>Other Service</caption>        
           <tr>
            <th>JIT Tribunal</th>
            <th>Fire Risk Assessments</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>            
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">     
            <td align="center">{!IF(ctrtx.Services_Taken_JIT__c=TRUE,"Yes","No")}</td>            
            <td align="center">{!IF(ctrtx.Services_Taken_FRA__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table> 

<!--Table 17 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>      
           <tr>
            <th>Training</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center">{!IF(ctrtx.Services_Taken_Training__c=TRUE,"Yes","No")}</td>            
          </tr>
            </apex:repeat> 
        </table> 
        
<!--Table 18 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>      
           <tr>
            <th>Consultancy</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center">{!IF(ctrtx.Services_Taken_Consultancy__c=TRUE,"Yes","No")}</td>            
          </tr>
            </apex:repeat> 
        </table>         
      
<!--Table 19 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>       
           <tr>
            <th></th>
            <th>Business Defence</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>            
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center"></td>            
            <td align="center">{!IF(ctrtx.Business_Defence__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table> 
      
<!--Table 20 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>       
           <tr>
            <th></th>
            <th>Environmental</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center"></td>            
            <td align="center">{!IF(ctrtx.Services_Taken_Env__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table> 

<!--Table 21 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="600"/>
           <col width="600"/>       
           <tr>
            <th></th>
            <th>eRAMS</th>
          </tr>
          <tr>
           <td width="600"/>
           <td width="600"/>
          </tr>  
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center"></td>            
            <td align="center">{!IF(ctrtx.Services_Taken_eRAMS__c=TRUE,"Yes","No")}</td>
          </tr>
            </apex:repeat> 
        </table> 
        
<!--Table 22 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>
           <caption>Terms &amp; Sales Notes</caption>        
           <tr>
            <th>Finance Notes</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">        
            <td align="center">{!ctrtx.Finance_Notes__c}</td>            
          </tr>
            </apex:repeat> 
        </table> 

<!--Table 23 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>     
           <tr>
            <th>Special Terms</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">         
            <td align="center">{!ctrtx.SpecialTerms}</td>            
          </tr>
            </apex:repeat> 
        </table> 
        
<!--Table 24 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>     
           <tr>
            <th>EL&amp;HR Notes</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">      
            <td align="center">{!ctrtx.PEL_Notes__c}</td>            
          </tr>
            </apex:repeat> 
        </table>    
        
<!--Table 25 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="1200"/>     
           <tr>
            <th>H&amp;S Notes</th>
          </tr>
          <tr>
           <td width="1200"/>
          </tr>
          <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}">                    
          <tr style="display:{!IF(ctrtx.LatestContract__c=false, 'None', '')}">       
            <td align="center">{!ctrtx.H_S_Notes__c}</td>            
          </tr>
            </apex:repeat> 
        </table>  
        
<!--Table 26 **************************************************************************************-->
         
          <table border="1" width="1200px" >
           <col width="65"/>
           <col width="240"/>
           <col width="240"/>           
           <col width="240"/>
           <col width="220"/>
           <col width="65"/>           
           <col width="65"/>   
           <col width="65"/>  
           <caption>Contacts and Users</caption>
           <tr>
            <th>Salutation</th>
            <th>Name</th>
            <th>Job Title</th>
            <th>Email Address</th>
            <th>Telephone No</th>
            <th>Super?</th>
            <th>EL&amp;HR?</th>
            <th>H&amp;S?</th>
          </tr>
          <tr>
           <td width="65"/>
           <td width="240"/>
           <td width="240"/>           
           <td width="240"/>
           <td width="220"/>
           <td width="65"/>           
           <td width="65"/>   
           <td width="65"/> 
          </tr>
        <apex:repeat var="conx" value="{!relatedTo.Contacts}">  
          <tr>
            <td align="center">{!conx.Salutation}</td>
            <td align="center">{!conx.Name}</td>
            <td align="center">{!conx.Title}</td>
            <td align="center">{!conx.email}</td>
            <td align="center">{!conx.phone}</td>
            <td align="center">{!conx.Online_Super_User__c}</td>
            <td align="center">{!conx.Helpline_PEL__c}</td>
            <td align="center">{!conx.Helpline_H_S__c}</td>
          </tr>
        </apex:repeat> 
        </table>               
      
<!--Table 27 **************************************************************************************-->
         
         <table border="1" width="1200px" >
           <col width="200"/>
           <col width="200"/>
           <col width="200"/>  
           <col width="200"/>
           <col width="200"/>
           <col width="200"/>
           <caption>Sites</caption>
           <tr>
            <th>Street</th>
            <th>City</th>
            <th>County</th>
            <th>Postcode</th>
            <th>Telephone No</th>
            <th>Site Type</th>
          </tr>
          <tr>
           <td width="200"/>
           <td width="200"/>
           <td width="200"/>  
           <td width="200"/>
           <td width="200"/>
           <td width="200"/>
          </tr>
        <apex:repeat var="sitex" value="{!relatedTo.Sites__r}">  
          <tr>
            <td align="center">{!sitex.Street__c}</td>
            <td align="center">{!sitex.City__c}</td>
            <td align="center">{!sitex.County__c}</td>
            <td align="center">{!sitex.Postcode__c}</td>
            <td align="center">{!sitex.Phone__c}</td>
            <td align="center">{!sitex.Site_Type__c}</td>
          </tr>
        </apex:repeat> 
        </table> 
      
        </font>
      </body>
    </html>
  </messaging:htmlEmailBody>
 </messaging:emailTemplate>

 
At the moment, I'm trying to "hello world" this component to put into a VF email. I am massively struggling though.

Here is what I have. First the Apex - this is to get the Contract whose detail is needed, the ID I am planning to get from the Contract record where the "Send Email" button will be hosted:
public class findContract {
  
public Id conID {get; set;}

    Public List<Contract> currentcontract = new List<Contract>();

    public List<Contract> findCurrentContract() {
        currentcontract = [SELECT Id, StartDate, Business_Type__c, Affinity__c, ContractTerm,  CompanySigned.name, CompanySignedDate, CustomerSigned.name, CustomerSignedDate, CustomerSignedTitle, 
        EndDate, Services_Taken_AI_Only__c, Services_Taken_AI_Only_HS__c, Services_Taken_Advice_Only__c, Services_Taken_Advice_Only_HS__c, Services_Taken_Franchise_Comp_EL__c, 
        Services_Taken_Franchise_Comp_HS__c, Services_Taken_Consultancy__c, Services_Taken_Franchise_Entry_EL__c, Services_Taken_Env__c, 
        Services_Taken_eRAMS__c, Services_Taken_FRA__c, Services_Taken_HS__c, Services_Taken_SBP__c, Services_Taken_Training__c, Services_Taken_JIT__c, H_S_Notes__c, 
        Finance_Notes__c, PEL_Notes__c, SpecialTerms FROM Contract WHERE Id = :conID];   
          

        return currentcontract ;
        
        }
    
}
Then we have the Component, currently this will not save with this error ( Error: Could not resolve the entity from <apex:outputField> value binding '{!con.ContractTerm}'. <apex:outputField> can only be used with SObjects, or objects that are Visualforce field component resolvable. )

I'm just trying to get an example 4 fields to put into the component!

I haven't got as far as putting the component in the VF email because I can't do the above. I'm expecting to have something like:
 
<c:DisplayContractDetails ContractID="{!Contract.Id}"/> 

*** I'm assuming I'll have to do something a bit more advanced to pull the current records id

I can see what I am trying to do logically, my skills are letting me down. Can anyone help?

Thanks and Happy New Year!


 
Hi. Fingers crossed this is simple.

I've made an email, it uses Account as the RelatedToType as it needs to source information from Contacts and Contracts. I had been using a Repeater to pull information from Contracts with a row limit of 1. What has transpired is that I cannot control the order in which information returns from the Repeater. I need the latest record, it will return whatever it has decided to pull back.

The result is that I need a controller to pull Contract information. This, right here, is where I am asking you for help. I haven't got a clue. 

It's not overly complex I would assume, just the latest related Contract record to the Account, and then a bit of guidance on how I replace the references to the repeater with the controller.

Thanks!
<!--Table 27 **************************************************************************************-->
         
         <table border="0" >
           <col width="150"/>
           <col width="150"/>
           <col width="150"/>           
           <col width="150"/>
           <col width="150"/>   
           <col width="150"/>  
           <caption>Contacts and Users</caption>
           <tr>
            <th>Street</th>
            <th>City</th>
            <th>County</th>
            <th>Postcode</th>
            <th>Telephone No</th>
            <th>Site Type</th>
          </tr>
        <apex:repeat var="sitex" value="{!relatedTo.Site}">  
          <tr>
            <td>{!sitex.Street__c}</td>
            <td>{!sitex.City__c}</td>
            <td>{!sitex.County__c}</td>
            <td>{!sitex.Postcode__c}</td>
            <td>{!sitex.phone}</td>
            <td>{!sitex.Site_Type__c}</td>
          </tr>
        </apex:repeat> 
        </table>

The above is causing this error: [Error] Error: Unknown property 'String.Street__c'.

Assuming I need something there to drag street name out of the error appropriately. Can someone assist with the syntax?

Thanks
As stated, I'm trying to pull a user and customer name and I'm getting the 15 character ID back instead. How do I get the actual name?

Code snippet:
 
<!--Table 10 **************************************************************************************-->
         
         <table border="0" >
           <col width="450"/>
           <col width="450"/>
           <tr>
            <th>Customer Signed By</th>
            <th>Position</th>
          </tr>
          <tr>
            <apex:repeat var="ctrtx" value="{!relatedTo.Contracts}" rows="1">          
            <td>{!ctrtx.CustomerSigned}</td>
            <td>{!ctrtx.CustomerSignedTitle}</td>
            </apex:repeat> 
          </tr>
        </table>

 
Hi,

Hoping this is a relatively easy query. I'm hoping to make a trigger that will send an email to all related Contacts (related on Account) on a Contract. 

Essentially, it is an anniversary catch up: Contract Start Date + X days/months/years = designated milestone then send email based on email template to all Contacts.

Can anyone help me out on this?

Thanks,
I know why it is happening, my array is empty. What I want to be able to do is provide a logica error for the end user, not a browser parped javascript technical error bubble.

Here is the code:

result1 = sforce.connection.query("SELECT ContractNumber FROM Contract where Id = \'" + idToUse + "\'");

records1 = result1.getArray("records");

for (var i = 0; i < records1.length; i++) {
    var record1 = records1[i];
    contrId1 = record1.ContractNumber.substring(0, 15);
}
The SoQL will occasionally be empty, so I need to flag some sort of "please make sure Contract Number has been entered" and exit the code. Can anyone help?

Hi,

As a complete Javascript novice, I'm trying to get some assistance here with a script to run a report from a button on the Contracts object that will parse some field data to a joined report. You can't do it with a URL hack, has to be javascript.

Luckily, I have some code to work from, it is rather transparent although I need some help amending it.

My issue is with pulling some information from Salesforce into the script, arrays and such things.
 

Essentially the code I have ripped is looking to parse one field, I am looking to parse two (a custom field from the Accounts object (sagecode__c for arguments sake) and one from the Contracts object itself (contractnumber__c for arguments sake).

This is the code, it is from the author so does not contain anything pertaining to what I am aiming to do in my own org. The header comments are mine.

// JScript source code
// This is a script which parses parameters to a Joined Report as URL hacking will not work in this instance.
// Background reading on solution is here: http://salesforce.stackexchange.com/questions/8723/passing-variables-to-joined-reports
// This script was sourced from here: https://gist.github.com/stephenbrown1/7443749
// Chrome extention tools to debug the report from here: http://forums.chrispederick.com/
// -- -- -- Click FORMS and VIEW FORM INFORMATION to find the reportJson details for this script after running report.
// This site URL encodes the JSON request: http://www.freeformatter.com/url-encoder.html
// Code is annotated where you need to make amendments

var url = "/00O90000004ewmO";    // report ID
var method = "POST";
var idArray = {!GETRECORDIDS($ObjectType.Contract_Partner_vod__c)};   // if the field you want for report critiera isn't avail from the detail record (ie list button) then need to get related data
var idToUse = idArray[0];

//alert(idToUse);

if (idToUse == null) {   // need to have at least 1 record selected
alert('You must select one contract partner record to run this report.');
} else {

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

result = sforce.connection.query("Select Id, Contract_vod__c from Contract_Partner_vod__c where Id = \'" + idToUse + "\'");

var contrId = null;

records = result.getArray("records");

for (var i=0; i< records.length; i++) {
var record = records[i];
contrId = record.Contract_vod__c.substring(0,15);
}

//alert(contrId);

// if the field you want for report critiera isn't avail from the detail record (ie list button) then need to get related data - in this case contract ID

// next line is post data - needs to be URL encoded. Note this is based on what comes from the runReportJson which you can get from running the report and checking firebug
var postData = "op=run&runReportJson=%7B%22last_modified_user_id%22%3A%22005900000022hZg%22%2C%22breaks%22%3A%5B%7B%22brkcol%22%3A%2200N90000007QeT8%22%2C%22break%22%3A%2200N90000007QeT8%22%2C%22sortColumn%22%3A%2200N90000007QeT8%22%2C%22brkord%22%3A%22up%22%2C%22breakLevel%22%3A%220%22%2C%22brkdat%22%3A%220%22%7D%5D%2C%22colorRanges%22%3A%5B%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22reln%22%3A%2200N90000007JDQt%22%2C%22currency%22%3A%22000%22%2C%22id%22%3A%2200O90000004ewmO%22%2C%22cust_devName%22%3A%22Contract_Price_List%22%2C%22cust_name%22%3A%22Contract+Price+List%22%2C%22last_modified_by%22%3A%22Paul+Hosking%22%2C%22details%22%3A%22no%22%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22lsk%22%2C%22value%22%3A%221%22%7D%2C%7B%22param%22%3A%22block_id_counter%22%2C%22value%22%3A%226%22%7D%5D%2C%22templateKey%22%3A%2201I900000018lXc00N90000007JDQt%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%5D%2C%22sortdir%22%3A%22down%22%2C%22sideBySide%22%3Afalse%2C%22blocks%22%3A%5B%7B%22templateKey%22%3A%2201I900000018lXc00N90000007JDQt%22%2C%22scope%22%3A%22organization%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%22FK_NAME%22%2C%22CUST_NAME%22%2C%2200N90000007QeUH%22%2C%2200N90000007QeT7%22%5D%2C%22last_modified_user_id%22%3A%22%22%2C%22sideBySide%22%3Afalse%2C%22sortdir%22%3A%22up%22%2C%22breaks%22%3A%5B%5D%2C%22a%22%3A%5B%2200N90000007QeT7%22%2C%2200N90000007QeUH%22%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22colorRanges%22%3A%5B%5D%2C%22reln%22%3A%2200N90000007JDQt%22%2C%22format%22%3A%22t%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22v%22%3A142%2C%22cust_name%22%3A%22Contract+Price+Rule%22%2C%22co%22%3A%22no%22%2C%22last_modified_date%22%3A%22%22%2C%22last_modified_by%22%3A%22%22%2C%22details%22%3A%22no%22%2C%22customAggregates%22%3A%5B%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%2C%22blockId%22%3A%22B1%22%2C%22csfReferences%22%3A%5B%22FORMULA1%22%2C%22FORMULA2%22%2C%22FORMULA3%22%2C%22FORMULA4%22%2C%22FORMULA5%22%2C%22FORMULA6%22%2C%22FORMULA7%22%5D%7D%2C%22rt%22%3A%2251%22%2C%22filters%22%3A%5B%7B%22pc%22%3A%22FK_CUSTENT_ID%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22" + contrId + "%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%5D%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22colDt_c%22%2C%22value%22%3A%2200N90000007QeY2%22%7D%2C%7B%22param%22%3A%22colDt_e%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22colDt_q%22%2C%22value%22%3A%22custom%22%7D%2C%7B%22param%22%3A%22colDt_s%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22function%22%2C%22value%22%3A%22c%22%7D%2C%7B%22param%22%3A%22name_op%22%2C%22value%22%3A%22co%22%7D%2C%7B%22param%22%3A%22save_drill%22%2C%22value%22%3A%22true%22%7D%5D%7D%2C%7B%22templateKey%22%3A%2201I900000018lXc%22%2C%22scope%22%3A%22organization%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%22CUST_NAME%22%2C%2200N90000007QeT6%22%5D%2C%22last_modified_user_id%22%3A%22%22%2C%22breaks%22%3A%5B%5D%2C%22sideBySide%22%3Afalse%2C%22sortdir%22%3A%22up%22%2C%22a%22%3A%5B%2200N90000007QeT6%22%5D%2C%22colorRanges%22%3A%5B%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22format%22%3A%22t%22%2C%22v%22%3A142%2C%22cust_name%22%3A%22List+Price%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22last_modified_date%22%3A%22%22%2C%22co%22%3A%22no%22%2C%22last_modified_by%22%3A%22%22%2C%22details%22%3A%22no%22%2C%22customAggregates%22%3A%5B%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%2C%22blockId%22%3A%22B0%22%7D%2C%22rt%22%3A%2251%22%2C%22filters%22%3A%5B%7B%22pc%22%3A%22CUST_RECORDTYPE%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22List_Price_Rule_vod%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeUG%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeT2%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeT1%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%5D%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22colDt_c%22%2C%22value%22%3A%2200N90000007QeY2%22%7D%2C%7B%22param%22%3A%22colDt_e%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22colDt_q%22%2C%22value%22%3A%22custom%22%7D%2C%7B%22param%22%3A%22colDt_s%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22function%22%2C%22value%22%3A%22c%22%7D%2C%7B%22param%22%3A%22name_op%22%2C%22value%22%3A%22co%22%7D%5D%7D%2C%7B%22templateKey%22%3A%2201I900000018lXc%22%2C%22scope%22%3A%22organization%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%22CUST_NAME%22%2C%2200N90000007QeUH%22%2C%2200N90000007QeT7%22%5D%2C%22last_modified_user_id%22%3A%22%22%2C%22breaks%22%3A%5B%5D%2C%22sideBySide%22%3Afalse%2C%22sortdir%22%3A%22up%22%2C%22colorRanges%22%3A%5B%5D%2C%22entity%22%3A%2201I900000018lXc%22%2C%22format%22%3A%22t%22%2C%22v%22%3A142%2C%22cust_name%22%3A%22STT+Price%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22last_modified_date%22%3A%22%22%2C%22co%22%3A%22no%22%2C%22last_modified_by%22%3A%22%22%2C%22details%22%3A%22no%22%2C%22customAggregates%22%3A%5B%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%2C%22blockId%22%3A%22B3%22%7D%2C%22rt%22%3A%2251%22%2C%22filters%22%3A%5B%7B%22pc%22%3A%2200N90000007QeT2%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeT1%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007JDQt%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeUG%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeY2%22%2C%22pn%22%3A%22ge%22%2C%22pv%22%3A%22TODAY%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%2200N90000007QeTC%22%2C%22pn%22%3A%22le%22%2C%22pv%22%3A%22TODAY%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%2C%7B%22pc%22%3A%22CUST_RECORDTYPE%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22Discount_Rule_vod%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%5D%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22colDt_c%22%2C%22value%22%3A%2200N90000007QeY2%22%7D%2C%7B%22param%22%3A%22colDt_e%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22colDt_q%22%2C%22value%22%3A%22custom%22%7D%2C%7B%22param%22%3A%22colDt_s%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22function%22%2C%22value%22%3A%22c%22%7D%2C%7B%22param%22%3A%22name_op%22%2C%22value%22%3A%22co%22%7D%5D%7D%5D%2C%22format%22%3A%22mb%22%2C%22created_by_user_id%22%3A%22005900000022hZg%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cfsize%22%3A12%2C%22cp%22%3A%22b%22%2C%22cheh%22%3Afalse%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22v%22%3A142%2C%22last_modified_date%22%3A%2214%2F11%2F2013+9%3A49+AM%22%2C%22co%22%3A%22yes%22%2C%22customAggregates%22%3A%5B%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22List+Price+List+Price%22%2C%22DeveloperName%22%3A%22FORMULA1%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22STT+Disc%22%2C%22DeveloperName%22%3A%22FORMULA2%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22STT+Net%22%2C%22DeveloperName%22%3A%22FORMULA3%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22STT+Disc+Net+Price%22%2C%22DeveloperName%22%3A%22FORMULA4%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22Contract+Disc+Net+Price%22%2C%22DeveloperName%22%3A%22FORMULA5%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22IF%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%3C%3E0%5Cn%2C+B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%5Cn%2C+IF%28B1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%3C%3E0%5Cn%2C%28B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+B1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%29+%2F+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%3C%3E0%5Cn%2CB3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%3C%3E0%5Cn%2C+%28B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%29%2FB0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%5Cn%2C0%5Cn%29%29%29%29%22%2C%22DataType%22%3A%22P%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22Final+Discount%22%2C%22DeveloperName%22%3A%22FORMULA6%22%2C%22RowBreakContext%22%3A%2200N90000007QeT8%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22IF%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+%3C%3E+0%5Cn%2C+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-%28B1%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*+B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%5Cn%2C+IF%28B1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG+%3C%3E+0%5Cn%2CB1%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+%3C%3E+0%5Cn%2CB0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG+-+%28B3%23Pricing_Rule_vod__c.Discount_Override_vod__c%3AAVG+*B0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%29%5Cn%2CIF%28B3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG+%3C%3E+0%5Cn%2CB3%23Pricing_Rule_vod__c.Net_Price_vod__c%3AAVG%5Cn%2CB0%23Pricing_Rule_vod__c.List_Price_vod__c%3AAVG%5Cn%29%29%29%29%22%2C%22DataType%22%3A%22C%22%2C%22IsActive%22%3Atrue%2C%22MasterLabel%22%3A%22Final+Net%22%2C%22DeveloperName%22%3A%22FORMULA7%22%2C%22Scale%22%3A2%7D%5D%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22x%22%7D%2C%22rt%22%3A%2251%22%2C%22cust_owner%22%3A%2200D90000000ome4%22%7D&repId=00O90000004ewmO";

// You REALLY want async = true.
// Otherwise, it'll block ALL execution waiting for server response.
var async = true;

var request = new XMLHttpRequest();




// Before we send anything, we first have to say what we will do when the
// server responds. This seems backwards (say how we'll respond before we send
// the request? huh?), but that's how Javascript works.
// This function attached to the XMLHttpRequest "onload" property specifies how
// the HTTP response will be handled.
request.onload = function () {

// Because of javascript's fabulous closure concept, the XMLHttpRequest "request"
// object declared above is available in this function even though this function
// executes long after the request is sent and long after this function is
// instantiated. This fact is CRUCIAL to the workings of XHR in ordinary
// applications.

// You can get all kinds of information about the HTTP response.

var status = request.status; // HTTP response status, e.g., 200 for "200 OK"
var data = request.responseText; // Returned data, e.g., an HTML document.
var x=window.open().document;
x.open();
x.write(data);
x.close();

}

request.open(method, url, async);

request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
// Or... request.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
// Or... whatever

// Actually sends the request to the server.
request.send(postData);
}
I can see what is going on, array is being created, SoQL query executing, value being stored. But there are some elements I am not sure of:

var idArray = {!GETRECORDIDS($ObjectType.Contract_Partner_vod__c)};   // if the field you want for report critiera isn't avail from the detail record (ie list button) then need to get

Unsure of the syntax I use here. I'm obviously to get ID's from an object to use in a query, I just need to know if I'm going to be formatting it correctly. I would ask our Java guys but I think this falls into the realm of Salesforce syntax.

records = result.getArray("records");

for (var i=0; i< records.length; i++) {
var record = records[i];
contrId = record.Contract_vod__c.substring(0,15);
}

Not sure what this piece of the code is aiming to do either. Is it truncating the 18 character ID? Because if so, I can probably kill this section of code off as I will be purely dealing with strings.



The rest seems relatively straightforward, it looks like I would have to duplicate the code to find my second field to parse. This person is obviously looking for his one custom field to parse to the report, as reflected by the search and result obtained.

Can anyone shed some light here to help me through?

Thanks.

Currently I have visualforce email template returning the values of mult select picklist.

The returned values display as: WidgetA;WidgetB;WidgetC

How can I them display as: WidgetA, WidgetB, WidgetC  (with a comma and space opposed to a semi-colon and now space)

Thanks in advance!

 

I've followed the instruction for accessing twitter api as given in the URL: http://wiki.developerforce.com/page/Getting_Started_with_TwitterForce

Followed all steps as they have mentioned. But on the twitter page, once i give credentials and click on login button, I get the below error.

Class.TwitterForce.execute: line 75, column 1
Class.TwitterForce.checkCreds: line 88, column 1
Class.TwitterForce.<init>: line 27, column 1
Class.TwitterController: line 19, column 1

Any light on this?

Thanks in Advance,
RR

  • March 23, 2014
  • Like
  • 0

Hello to all. 

I have an object called ABC. 

This ABC has one child called BOOK__c

Also there is another object Pencil__c which has a lookup to ABC and has a related list of contacts. 


Whenever BOOK__c record is checked completed (BOOK.Completed__c = True), I want to send an email to all Contacts in related list of Pencil__c of BOOK__c's parent ABC. 

How can I figure this out?