• Kim Wojno
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 9
    Replies
Hello!
I am trying to create a new template but everytime i try to reference the opportunity I get this.
Error: Unknown property 'core.email.template.EmailTemplateComponentController.Opportunity

Here is the code:
<messaging:emailTemplate subject="WeddingWire Receipt" recipientType="Contact" relatedToType="Opportunity">
<messaging:htmlEmailBody >

<p style="font-family: Helvetica, Arial, sans-serif; font-size: 12px">Hi {!recipient.name},</p>
<p style="font-family: Helvetica, Arial, sans-serif; font-size: 12px">Congratulations! You now have access to premium WeddingWire benefits. Your order has been processed successfully. Here are the details:
</p>
<p style="font-family: Helvetica, Arial, sans-serif; font-size: 12px">
<strong>Confirmation Number: </strong><apex:outputField value="{!Opportunity.Transaction_ID__c}"/>
<br></br>
<strong>Product:</strong>
<br></br>
<br></br>
<strong>Total Contract Value: </strong>
<br></br>
<br></br>
<strong>Sales Price: </strong>{!Opportunity.Amount}
<br></br>
<strong>Payment Plan: </strong>
<br></br>
<strong>Installment Amount:  </strong>
<br></br>
<strong>Sales Rep: </strong>
<br></br>
<strong>Term: </strong>12 Months
<br></br>
<br></br>

'
I am creating test class for my trigger but keep getting an error on the last line where it doesn't recgonize "WHERE." Any thoughts?
@isTest
public class ContractGeneratorTest{
    static testMethod void validateContractAttachment(){
        opportunity opp= new Opportunity();
        Opp.StageName = 'Generate Contract';
        Opp.Contract_Attached__c = 'FALSE';
        
        insert opp;
        
        Attachment attach=new Attachment(); 
        attach.Name='Contract Test Attachment';
        Blob bodyBlob=Blob.valueOf('Contract Attachment Body'); 
        attach.body = bodyBlob; 
        attach.Id = opp.id;
        
        insert attach;
        
        List<Attachment> attach=[SELECT opportunity WHERE attach.Id = opp.id]; 
        
        System.assertEquals(1, attachments.size()); 
    }
}
Here is the trigger: 
trigger GenerateContract on Opportunity (after update, after insert) {

     list<id> opportunityId = new list<id>();
     for(opportunity opp: trigger.new){
     if(opp.StageName=='Generate Contract' && opp.Contract_Attached__c == False)
        {
         opportunityId.add(opp.id);
        } 
      }
        
        AccountTriggerController.addPDFAttach(userInfo.getSessionId(), opportunityId);
        }



I am looking to put in a trigger that will automatically attach a pdf contract from a VF page to the opportunity. Below is what I have (via http://jungleeforce.wordpress.com/2013/05/08/generate-a-pdf-and-attach-it-to-record-from-a-trigger-in-salesforce/) and modified. However I want to put in an if statement but I keep getting the error "Concrete SObject."  The if stament I am trying to put in:
if(opportunity.stageName == 'Sent Contract for Review' && opportunity.Contract_Attached__c == False)

Any help here? I am referencing the opportunity ID in the list but need a way to make it reference the opportunity itself with only one action being done. 

trigger GenerateContract on Opportunity (after update, after insert) {

     list<id> opportunityId = new list<id>();
     for(id opportunity: trigger.newMap.keySet()){
         opportunityId.add(opportunity);
      }
        
        AccountTriggerController.addPDFAttach(userInfo.getSessionId(), opportunityId);
Hello!
I am trying to create a new template but everytime i try to reference the opportunity I get this.
Error: Unknown property 'core.email.template.EmailTemplateComponentController.Opportunity

Here is the code:
<messaging:emailTemplate subject="WeddingWire Receipt" recipientType="Contact" relatedToType="Opportunity">
<messaging:htmlEmailBody >

<p style="font-family: Helvetica, Arial, sans-serif; font-size: 12px">Hi {!recipient.name},</p>
<p style="font-family: Helvetica, Arial, sans-serif; font-size: 12px">Congratulations! You now have access to premium WeddingWire benefits. Your order has been processed successfully. Here are the details:
</p>
<p style="font-family: Helvetica, Arial, sans-serif; font-size: 12px">
<strong>Confirmation Number: </strong><apex:outputField value="{!Opportunity.Transaction_ID__c}"/>
<br></br>
<strong>Product:</strong>
<br></br>
<br></br>
<strong>Total Contract Value: </strong>
<br></br>
<br></br>
<strong>Sales Price: </strong>{!Opportunity.Amount}
<br></br>
<strong>Payment Plan: </strong>
<br></br>
<strong>Installment Amount:  </strong>
<br></br>
<strong>Sales Rep: </strong>
<br></br>
<strong>Term: </strong>12 Months
<br></br>
<br></br>

'
I am creating test class for my trigger but keep getting an error on the last line where it doesn't recgonize "WHERE." Any thoughts?
@isTest
public class ContractGeneratorTest{
    static testMethod void validateContractAttachment(){
        opportunity opp= new Opportunity();
        Opp.StageName = 'Generate Contract';
        Opp.Contract_Attached__c = 'FALSE';
        
        insert opp;
        
        Attachment attach=new Attachment(); 
        attach.Name='Contract Test Attachment';
        Blob bodyBlob=Blob.valueOf('Contract Attachment Body'); 
        attach.body = bodyBlob; 
        attach.Id = opp.id;
        
        insert attach;
        
        List<Attachment> attach=[SELECT opportunity WHERE attach.Id = opp.id]; 
        
        System.assertEquals(1, attachments.size()); 
    }
}
Here is the trigger: 
trigger GenerateContract on Opportunity (after update, after insert) {

     list<id> opportunityId = new list<id>();
     for(opportunity opp: trigger.new){
     if(opp.StageName=='Generate Contract' && opp.Contract_Attached__c == False)
        {
         opportunityId.add(opp.id);
        } 
      }
        
        AccountTriggerController.addPDFAttach(userInfo.getSessionId(), opportunityId);
        }



I am looking to put in a trigger that will automatically attach a pdf contract from a VF page to the opportunity. Below is what I have (via http://jungleeforce.wordpress.com/2013/05/08/generate-a-pdf-and-attach-it-to-record-from-a-trigger-in-salesforce/) and modified. However I want to put in an if statement but I keep getting the error "Concrete SObject."  The if stament I am trying to put in:
if(opportunity.stageName == 'Sent Contract for Review' && opportunity.Contract_Attached__c == False)

Any help here? I am referencing the opportunity ID in the list but need a way to make it reference the opportunity itself with only one action being done. 

trigger GenerateContract on Opportunity (after update, after insert) {

     list<id> opportunityId = new list<id>();
     for(id opportunity: trigger.newMap.keySet()){
         opportunityId.add(opportunity);
      }
        
        AccountTriggerController.addPDFAttach(userInfo.getSessionId(), opportunityId);