• David@DeinDeal
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

Hi,

 

I have a custom object Frame_Agreements__c with two lookupfields(Account, Contract) to Account and Contract. I have written a trigger to insert the records in Frame_Agreements__c as soon as new contract is created. But its not working...Can anyone help me..

 

 

trigger ConRelate on Contract (after insert, after update){
//List<Contract> listContracts=new List<Contract>;
List<Frame_Agreement__c> Lac = new List<Frame_Agreement__c>();
Set<ID> Cid = new Set<ID>();
for(Contract ctr : Trigger.New)
{
CId.add(ctr.Id);
}
List<Contract> cont = [select ContractNumber,Contract.Account.Name from contract where Id in :CId];

for (Contract fContract : cont) {

Frame_Agreement__c fac = new Frame_Agreement__c();
//fac.Name = fContract.Name;
//fac.Id = fContract.Id;
fac.Account_Name__c= fContract.Account.Id;
fac.Contract_Name__c=fContract.Id;

Lac.add(fac);
}

/*if (cont.isEmpty() == false) {
update cont;
}*/
}

 

  • September 01, 2013
  • Like
  • 0

Anyone ever seen this before?

I get this error when trying to send a Messaging.SingleEmailMessage...

 

 

public void emailCVToContact(SystemContactRecord contactRecord, List<ID> attachmentIds, String fromEmailAddress, String candidateName) { Messaging.SingleEmailMessage singleCVEmail = new Messaging.SingleEmailMessage(); singleCVEmail.setReplyTo(fromEmailAddress); singleCVEmail.setSaveAsActivity(false); singleCVEmail.setSubject('Candidate CV : ' + candidateName); singleCVEmail.setDocumentAttachments(attachmentIds); singleCVEmail.setHtmlBody(' This is a test email'); singleCVEmail.setToAddresses(new String[]{contactRecord.con.Email}); //Now send the email try { List<Messaging.SendEmailResult> emailSendResults = Messaging.sendEmail(new Messaging.SingleEmailMessage[]{singleCVEmail}); //ERROR GENERATED HERE!! for(Messaging.SendEmailResult sentEmailResult : emailSendResults) { if(!sentEmailResult.isSuccess()) { //There was a problem sending the email, so print the error messages //to the system logs List<Messaging.SendEmailError> resultsErrors = sentEmailResult.getErrors(); if(resultsErrors.size() > 0) for(Messaging.SendEmailError sendMailError : resultsErrors) System.debug('***** SEND EMAIL ERROR MESSAGE: ' + sendMailError.getMessage()); } //else sent successfully regardless of post problems else { //break out of loop - only single email enabled numberOfEmailsActuallySent++; break; }//close else }//close for }catch(EmailException ee) { System.debug('***** THERE WAS AN ISSUE SEND THE QUOTE TO THE DESTINATION EMAIL: ' + ee.getMessage()); } }

 

 I've never seen this before...

Any info appreciated!

Thanks

 

  • February 22, 2009
  • Like
  • 0