• apple_sae
  • NEWBIE
  • 25 Points
  • Member since 2012

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

I'm trying to build an edit page that contains a save and cancel button. The page has a required field and also has a custom controller.

The problem is that when I press the cancel button to invoke my cancel action, the cancel action is not invoked and instead the page displays an error that I must enter a value for the required field if I have no text in the field.

Is there a way to have this logic bypassed for a cancel action?

 

public PageReference cancelSendEmail(){
		string DocIDEmail = '';
		mailForm = false;
		return null;
	}

 

<apex:form >

<label>Email address</label>
<apex:inputText value="{!addresses}" id="addresses" maxlength="80" required="true"/>

<label>Subject</label>
<apex:inputText value="{!Temp.Subject}" label="Subject" id="Subject" maxlength="80" required="true"/>

<label>Body</label>
<apex:inputtextarea rows="8" cols="80" value="{!Temp.Body}" label="Body" id="Body"/>
  
<apex:commandButton value="cancel" action="{!cancelSendEmail}" immediate="true"/>
                       
<apex:commandButton value="Send Email" action="{!send}">
  <apex:variable var="DVId" value="{!DocVs.Id}"/>
  <apex:inputHidden value="{!DVId}" id="theHiddenInput"/>
</apex:commandButton>                 

</apex:form >

 

Hi There,

 

I'm using visualforce page to specify to email address to send email and should be attached file, 

 

I want create from to send to anyone and can keep tracking to Activity History of Contact belong to this document.

 

 

SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []

 

public with sharing class paymenthistoryCls {  
	
	public string uid;
	public string aid;
	public string cid; 
	public User objUser{get;set;}
	public list<Document__c> lstDocument{get;set;}
	public String DocId{get; set;}
    public String attId{get;set;}
    public String addresses{ get; set;}	
    	
	public paymenthistoryCls(){
		uid = Apexpages.currentPage().getParameters().get('id');//UserInfo.getUserId();
		getObjUser();
		getlstDocument();
	} 
	
	public void getObjUser(){
		if(uid != null){
		objUser = [Select 	User.ContactId,
							User.AccountId,
							User.UserType
	   				From	User
	   				Where	User.Id = :uid ];
	   	aid = objUser.AccountId;
	   	cid = objUser.ContactId;	
		}
	}
	
	public void getlstDocument(){
	lstDocument = [	SELECT	Document__c.Id,
	    							Document__c.Name,
	    							Document__c.Document_Name__c,
	    							Document__c.Description__c,
	    							Document__c.CreatedDate,
	    							Document__c.LastModifiedDate,
	    							(SELECT Document_Version__c.Id
	    							FROM	Document_Version__r)
	    					FROM	Document__c
	    					Where	Document__c.Account__c = :aid];
	}
	    
    public PageReference send() {
        PageReference pageReference =  ApexPages.currentPage();        
    	Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
        
        // Create the email attachment
       
		List<Messaging.EmailFileAttachment> efas = new List<Messaging.EmailFileAttachment>();
		
   	    for(Attachment a : [select	Attachment.Id,
	   	    						Attachment.Name,  
	   	    						Attachment.Body 
	   	    			 	from 	Attachment 
	   	    			 	where 	Attachment.ParentId = :attId]){
    	
	    	Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
	    	efa.setFileName(a.Name);
	    	efa.setBody(a.body);
			efas.add(efa);
   	   }
   	   String[] toAddresses;
   	   if(addresses != ''){
		toAddresses = addresses.split(';', 0);	
   	   }
   	   EmailTemplate Temp = [Select EmailTemplate.Id , EmailTemplate.Name From EmailTemplate Where Name = 'Portal: Send Document'];
		
        email.setTargetObjectId(cid);        
        email.setSaveAsActivity(false);       
        email.setTemplateId(Temp.id);
        email.setToAddresses( toAddresses );        
        email.setFileAttachments(efas);
        email.setWhatId(attid);
		
	Messaging.SendEmailResult[] results = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
	system.debug('result size ='+ results.size());
	ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,  'Email has been resent successfully '+results.size()+'.'+attId));
		return ApexPages.currentPage();
    }
}

 

23.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
02:46:06.031 (31183000)|EXECUTION_STARTED
02:46:06.031 (31240000)|CODE_UNIT_STARTED|[EXTERNAL]|066W00000008eni|VF: /apex/paymenthistory
02:46:06.032 (32175000)|VF_DESERIALIZE_VIEWSTATE_BEGIN|066W00000008eni
02:46:06.042 (42671000)|VF_DESERIALIZE_VIEWSTATE_END
02:46:06.043 (43632000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls get(lstDocument)
02:46:06.043 (43658000)|SYSTEM_MODE_ENTER|true
02:46:06.043 (43688000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|lstDocument
02:46:06.043 (43727000)|METHOD_ENTRY|[1]|01pW0000000D4RH|paymenthistoryCls.paymenthistoryCls()
02:46:06.043 (43828000)|SYSTEM_MODE_ENTER|false
02:46:06.043 (43840000)|SYSTEM_MODE_EXIT|false
02:46:06.043 (43850000)|METHOD_EXIT|[1]|paymenthistoryCls
02:46:06.043 (43862000)|CODE_UNIT_FINISHED|lstDocument
02:46:06.043 (43869000)|CODE_UNIT_FINISHED|paymenthistoryCls get(lstDocument)
02:46:06.054 (54757000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls get(addresses)
02:46:06.054 (54783000)|SYSTEM_MODE_ENTER|true
02:46:06.054 (54797000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|addresses
02:46:06.054 (54814000)|CODE_UNIT_FINISHED|addresses
02:46:06.054 (54820000)|CODE_UNIT_FINISHED|paymenthistoryCls get(addresses)
02:46:06.057 (57496000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57512000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57526000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57573000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57581000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57659000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57677000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57689000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57710000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57717000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57784000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.057 (57797000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57807000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.057 (57826000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.057 (57834000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.057 (57896000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57909000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57919000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57939000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57946000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.058 (58011000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58025000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58035000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58054000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58061000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58124000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58137000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58147000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58171000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58179000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58244000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58257000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58267000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58286000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58293000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58355000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58368000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58378000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58398000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58405000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58470000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58482000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58492000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58511000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58518000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58581000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58593000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58606000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58625000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58632000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58713000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58726000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58736000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58755000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58762000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58826000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58838000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58849000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58868000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58875000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58940000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58953000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58963000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58982000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58989000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.059 (59052000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59065000)|SYSTEM_MODE_ENTER|true
02:46:06.059 (59076000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59095000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59102000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.060 (60968000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls invoke(send)
02:46:06.061 (61059000)|SYSTEM_MODE_ENTER|false
02:46:06.061 (61102000)|SYSTEM_METHOD_ENTRY|[44]|ApexPages.currentPage()
02:46:06.061 (61242000)|SYSTEM_METHOD_EXIT|[44]|ApexPages.currentPage()
02:46:06.062 (62232000)|SYSTEM_CONSTRUCTOR_ENTRY|[49]|<init>()
02:46:06.062 (62266000)|SYSTEM_CONSTRUCTOR_EXIT|[49]|<init>()
02:46:06.062 (62306000)|METHOD_ENTRY|[51]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.062 (62343000)|METHOD_EXIT|[51]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.063 (63343000)|SOQL_EXECUTE_BEGIN|[51]|Aggregations:0|select Attachment.Id, Attachment.Name, Attachment.Body from Attachment 
02:46:06.118 (118130000)|SOQL_EXECUTE_END|[51]|Rows:1
02:46:06.118 (118256000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocator.iterator()
02:46:06.118 (118449000)|SYSTEM_METHOD_ENTRY|[7]|QueryLocatorIterator.QueryLocatorIterator()
02:46:06.118 (118464000)|SYSTEM_METHOD_EXIT|[7]|QueryLocatorIterator
02:46:06.118 (118627000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocator.iterator()
02:46:06.118 (118648000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118748000)|SYSTEM_METHOD_ENTRY|[33]|LIST<Attachment>.size()
02:46:06.118 (118784000)|SYSTEM_METHOD_EXIT|[33]|LIST<Attachment>.size()
02:46:06.118 (118804000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118815000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.next()
02:46:06.118 (118830000)|SYSTEM_METHOD_ENTRY|[48]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118852000)|SYSTEM_METHOD_ENTRY|[33]|LIST<Attachment>.size()
02:46:06.118 (118861000)|SYSTEM_METHOD_EXIT|[33]|LIST<Attachment>.size()
02:46:06.118 (118869000)|SYSTEM_METHOD_EXIT|[48]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118909000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.next()
02:46:06.119 (119249000)|SYSTEM_METHOD_ENTRY|[60]|LIST<Messaging.EmailFileAttachment>.add(Object)
02:46:06.119 (119285000)|SYSTEM_METHOD_EXIT|[60]|LIST<Messaging.EmailFileAttachment>.add(Object)
02:46:06.119 (119294000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.119 (119306000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.119 (119325000)|METHOD_ENTRY|[63]|01pW0000000D4RH|paymenthistoryCls.__sfdc_addresses()
02:46:06.119 (119356000)|METHOD_EXIT|[63]|01pW0000000D4RH|paymenthistoryCls.__sfdc_addresses()
02:46:06.119 (119776000)|SOQL_EXECUTE_BEGIN|[66]|Aggregations:0|select EmailTemplate.Id, EmailTemplate.Name from EmailTemplate where Name = 'Portal: Send Document'
02:46:06.122 (122867000)|SOQL_EXECUTE_END|[66]|Rows:1
02:46:06.123 (123431000)|METHOD_ENTRY|[73]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.123 (123457000)|METHOD_EXIT|[73]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.123 (123567000)|SYSTEM_CONSTRUCTOR_ENTRY|[75]|<init>()
02:46:06.123 (123595000)|SYSTEM_CONSTRUCTOR_EXIT|[75]|<init>()
02:46:06.123 (123617000)|SYSTEM_METHOD_ENTRY|[75]|LIST<Messaging.SingleEmailMessage>.add(Object)
02:46:06.123 (123631000)|SYSTEM_METHOD_EXIT|[75]|LIST<Messaging.SingleEmailMessage>.add(Object)
02:46:06.123 (123683000)|SYSTEM_METHOD_ENTRY|[75]|Messaging.sendEmail(LIST<Messaging.Email>)
02:46:06.183 (183772000)|EXCEPTION_THROWN|[75]|System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []
02:46:06.184 (184625000)|SYSTEM_METHOD_EXIT|[75]|Messaging.sendEmail(LIST<Messaging.Email>)
02:46:06.184 (184655000)|SYSTEM_MODE_EXIT|false
02:46:06.184 (184741000)|FATAL_ERROR|System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []

Class.paymenthistoryCls.send: line 75, column 1
02:46:06.184 (184764000)|CODE_UNIT_FINISHED|paymenthistoryCls invoke(send)

 

 

 

 

 

Hi All,

 

I have Visualforce Page to list the case and have function to send email with attachment below the cases but I got the error like this:

 

Attempt to de-reference a null object

Error is in expression '{!send}' in component <apex:page> in page sendemailpage
 
public class outboundMessage {
	
    public Id cid;
    public Contact contact;
    public list<Case> cases {get; set;}
    public String attId{get;set;}
    public String addresses{ get; set;}

    // Create a constructor that populates the Account object 
    
    public outboundMessage() {
    	cid = ApexPages.currentPage().getParameters().get('id');
    	getContact();
    	getCases();        
    }
	
    public void getContact() {
    	contact = [Select	Contact.Id,
				Contact.Name,
				Contact.FirstName,
				Contact.LastName,
				Contact.Phone,
				Contact.Email,
				Contact.MailingStreet,
   				Contact.MailingCity,
   				Contact.MailingState,
   				Contact.MailingPostalCode,
   				Contact.MailingCountry
   		    From	Contact
                    WHERE       Contact.Id = :cid];
    }
    
    public void getCases(){
    	if(cid != null){
    	cases = [Select	Case.Id,
			Case.CaseNumber,
			Case.Subject,
			Case.CreatedDate,
			Case.Description,
			Case.ClosedDate,
   			(SELECT	Attachment.Id, Attachment.Name	    					 
			FROM	Case.Attachments)
    		From	Case
    		Where	Case.ContactId = :cid];
    	}
    }
    
	public String attstrMessage{
        get{
             if(attstrMessage != null){
                return  attstrMessage;
              }else{
                  return '';
              }          
         }
          private set;
        } 
         
    public PageReference send() {
    	PageReference pageReference =  ApexPages.currentPage();        
    	try{
    	Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
        
        List<Messaging.EmailFileAttachment> efas = new List<Messaging.EmailFileAttachment>();
		
   	    for(Attachment a : [select	Attachment.Id,
   	    				Attachment.Name,  
   	    				Attachment.Body 
   	    			from 	Attachment 
   	    			where 	Attachment.Id = :attId]){
    	
	    	Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
	    	efa.setFileName(a.Name);
	    	efa.setBody(a.body);
			efas.add(efa);
   	   }
		
		String[] toAddresses = addresses.split(':', 0);	
		
        // Sets the paramaters of the email 
    
        email.setTargetObjectId(cid);        
        email.setSaveAsActivity(false);       
        email.setTemplateId('00X90000000fCao');
        email.setToAddresses( toAddresses );        
        email.setFileAttachments(efas);
		
	Messaging.SendEmailResult[] results = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
	        if (results[0].isSuccess()) {
	               if(efas.size() > 0){
	                    pageReference.getParameters().put('message',' Email has been resent successfully with attachments.');
	               }else{
	                pageReference.getParameters().put('message',' Email has been resent successfully .');
	               }
	               attstrMessage=''; 	                      
	         } else {
	             ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,  'Failed to resend Email.'));
	             pageReference.getParameters().put('messagefail',' Failed to resend Email.');
	         }
	         ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,  'Email has been resent successfully '+attstrMessage+'.'));
		}catch(System.EmailException ex ){
             system.debug('============== email exception caught!!!============='+ex.getMessage());
              pageReference.getParameters().put('messagefail',' Failed to resend Email.');
              ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,  'Failed to resend Email.'));
        }
		return ApexPages.currentPage();
    }
}

 

 
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" Controller="outboundMessage" >
<apex:messages />
	
	<apex:repeat value="{!cases}" var="c">
    	<ul class="your-docs docs">
        <li  class="your-doc doc">
           <h4 class="doc-title">
           	<apex:outputText value="{!c.CaseNumber}"/> <apex:outputText value="{!c.Subject}"/>&raquo;
           </h4>
           <div class="doc-desc">{!c.Description}</div>
		<div class="record" id="recordEmail">
			<div class="data-wrapper">
				<ul class="doc-operations">
				<li>Edit</li>
		               	<li class="operations"><a href="#">Email</a></li>
		               	<li>Print</li>
				</ul>
			</div>
			<div class="form-wrapper">
				<apex:form >
					<apex:outputLabel value="email" for="Addressed"/>:
					<apex:inputText value="{!addresses}" id="addresses" maxlength="80"/>			<apex:repeat value="{!c.Attachments}" var="att">							 
					attachment name: <apex:outputText value="{!att.name}"/>
					<div class="form-actions">
                        	            <button class="cancel">Cancel</button>
					    <apex:commandButton value="Send Email" action="{!send}" styleClass="button-medium">
					    <apex:param name="attSend" value="{!att.Id}" assignTo="{!attId}"></apex:param>	
					   </apex:commandButton>
		                        </div>
					</apex:repeat>	 
				    </apex:form>
				</div>
			</div>
		</li>
		</ul>
	</apex:repeat>	
</apex:page>

 

20.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
15:31:42.014 (14629000)|EXECUTION_STARTED
15:31:42.014 (14672000)|CODE_UNIT_STARTED|[EXTERNAL]|06690000001qGv5|VF: /apex/sendEmailPage
15:31:42.014 (14890000)|VF_DESERIALIZE_VIEWSTATE_BEGIN|06690000001qGv5
15:31:42.029 (29723000)|VF_DESERIALIZE_VIEWSTATE_END
15:31:42.030 (30622000)|CODE_UNIT_STARTED|[EXTERNAL]|01p90000001ziVK|outboundMessage get(cases)
15:31:42.030 (30640000)|SYSTEM_MODE_ENTER|true
15:31:42.030 (30660000)|CODE_UNIT_STARTED|[EXTERNAL]|01p90000001ziVK|cases
15:31:42.030 (30697000)|METHOD_ENTRY|[1]|01p90000001ziVK|outboundMessage.outboundMessage()
15:31:42.030 (30794000)|METHOD_EXIT|[1]|outboundMessage
15:31:42.030 (30808000)|CODE_UNIT_FINISHED|cases
15:31:42.030 (30819000)|CODE_UNIT_FINISHED|outboundMessage get(cases)
15:31:42.037 (37406000)|CODE_UNIT_STARTED|[EXTERNAL]|01p90000001ziVK|outboundMessage invoke(send)
15:31:42.037 (37501000)|SYSTEM_METHOD_ENTRY|[60]|ApexPages.currentPage()
15:31:42.037 (37589000)|SYSTEM_METHOD_EXIT|[60]|ApexPages.currentPage()
15:31:42.038 (38499000)|SYSTEM_CONSTRUCTOR_ENTRY|[66]|<init>()
15:31:42.038 (38530000)|SYSTEM_CONSTRUCTOR_EXIT|[66]|<init>()
15:31:42.038 (38564000)|METHOD_ENTRY|[68]|01p90000001ziVK|outboundMessage.__sfdc_attId()
15:31:42.038 (38595000)|METHOD_EXIT|[68]|01p90000001ziVK|outboundMessage.__sfdc_attId()
15:31:42.038 (38890000)|SOQL_EXECUTE_BEGIN|[68]|Aggregations:0|select Attachment.Id, Attachment.Name, Attachment.Body from Attachment 
15:31:42.044 (44173000)|SOQL_EXECUTE_END|[68]|Rows:0
15:31:42.044 (44229000)|SYSTEM_METHOD_ENTRY|[68]|Database.QueryLocator.iterator()
15:31:42.044 (44327000)|SYSTEM_METHOD_ENTRY|[7]|QueryLocatorIterator.QueryLocatorIterator()
15:31:42.044 (44341000)|SYSTEM_METHOD_EXIT|[7]|QueryLocatorIterator
15:31:42.044 (44401000)|SYSTEM_METHOD_EXIT|[68]|Database.QueryLocator.iterator()
15:31:42.044 (44417000)|SYSTEM_METHOD_ENTRY|[68]|Database.QueryLocatorIterator.hasNext()
15:31:42.044 (44436000)|SYSTEM_METHOD_EXIT|[68]|Database.QueryLocatorIterator.hasNext()
15:31:42.044 (44453000)|METHOD_ENTRY|[80]|01p90000001ziVK|outboundMessage.__sfdc_addresses()
15:31:42.044 (44478000)|METHOD_EXIT|[80]|01p90000001ziVK|outboundMessage.__sfdc_addresses()
15:31:42.044 (44514000)|EXCEPTION_THROWN|[80]|System.NullPointerException: Attempt to de-reference a null object
15:31:42.046 (46629000)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

Class.outboundMessage.send: line 80, column 1
15:31:42.046 (46641000)|CODE_UNIT_FINISHED|outboundMessage invoke(send)

 

Thank for any help ! ! !

 
 
 
 
 

Dear Expert,

I am trying to Pass parameter to Apex method from VF page.It work for remove But i am not able to get the parameter value for update.

 

<apex:repeat value="{!lstAuthContacts}" var="AC">
 <apex:form >
 <apex:commandLink value="Remove" action="{!removeContact}">
   <apex:param name="delContact" value="{!AC.Id}" assignTo="{!cParam}"></apex:param>
 </apex:commandLink>

<label>First name*</label>
<apex:inputField value="{!AC.FirstName}" styleClass="form-text" id="form-text-contact-first-name"/>

<label>Last name*</label>
<apex:inputField value="{!AC.LastName}" styleClass="form-text" id="form-text-contact-last-name"/>
<label>Phone*</label>
<apex:inputField value="{!AC.Phone}" styleClass="form-text" id="form-text-contact-phone"/>
<label>Email address*</label>
<apex:inputField value="{!AC.Email}" styleClass="form-text" id="form-text-contact-email"/>

<apex:commandButton action="{!updateAuthContact}" value="Save updates" id="theButton"> <apex:param name="updateContact" value="{!AC.Id}" assignTo="{!cParam}"></apex:param> </apex:commandButton>
</apex:form>
</apex:repeat>

 

 

public with sharing class AccountProfileController {
public Id aid {get;set;}
public string cParam{get;set;} public list<Contact> lstAuthContacts{get;set;} public AccountProfileController(){ getlstAuthContacts(); } private void getlstAuthContacts(){ aid = Apexpages.currentPage().getParameters().get('id'); if(aid != ''){ lstAuthContacts = [Select Contact.Id, Contact.Name, Contact.Contact_Type__c, Contact.FirstName, Contact.LastName, Contact.Phone, Contact.Email, Contact.MailingStreet, Contact.MailingCity, Contact.MailingState, Contact.MailingPostalCode, Contact.MailingCountry, Contact.Living_Will__c From Contact Where Contact.AccountId = :aid And Contact.Contact_Type__c = 'Authorized Contact']; } }
public PageReference removeContact(){
if(cParam != ''){
Contact toDel=new Contact(id=cParam);
delete todel;
getlstAuthContacts
}
returm null;
}
public PageReference updateAuthContact() {
if(cParam != ''){
Contact toUpdate=new Contact(id=cParam);
update toUpdate;
getlstAuthContacts();
}
return null;
}
}



Hi All,

I have query my attachment from my custom object using Relationship Queries,

 

but I don't know how I can display my attachment ID , I got error  Save error: Unknown property 'VisualforceArrayList.id' 

 

 I have queries and VF page like this:

 

public class documentCls {
	public Id uid;
	public Integer counter{get;set;}
	public list<Document__c> lstDocument{get;set;}
	public list<Document_Version__c> lstDocVs{get;set;}
	public list<Attachment> Attach{get;set;}
	public documentCls(){
		getlstDocument();
		getlstDocVs();	
	}
	
	public void getlstDocument(){
		uid = UserInfo.getUserId();
    	if(uid != ''){ 
    		lstDocument = [	SELECT	Document__c.Id,
	    				Document__c.Name,
	    				Document__c.Document_Name__c,
	    				Document__c.Description__c
	    			FROM	Document__c
	    			Where	Document__c.OwnerId = :uid];
	    					
	    	counter = [	SELECT 	Count()
	    			FROM	Document__c
	    			Where	Document__c.OwnerId = :uid];
	    				
	    	System.debug('My counted records: ' + counter);  
    	}  	
    }
     public void getlstDocVs(){
    	if(lstDocument.size() > 0){
    		for(Document__c d:lstDocument){
    			
    			lstDocVs = [SELECT	Document_Version__c.Id,
Document_Version__c.Document__r.Document_Name__c, Document_Version__c.Document__r.Description__c, Document_Version__c.Document__r.CreatedDate, Document_Version__c.Document__r.LastModifiedDate, (SELECT Attachment.Id
FROM Document_Version__c.Attachments) FROM Document_Version__c WHERE Document_Version__c.Document__c = :d.id ORDER BY Document_Version__c.Document__r.CreatedDate DESC]; } }else{ system.debug('Document is null'); } } }

 

<apex:page showHeader="false" standardStylesheets="false" sidebar="false" Controller="documentCls">
<div class="tab-pane" id="your-documents">
<div class="doc-alert">You have {!counter} new document ready for download!</div>
<apex:repeat value="{!lstDocVs}" var="v">
<ul class="doc-steps">
<li>
<apex:outputText value="{!v.Document__r.Document_Name__c}"/>
<apex:outputLink value="{!URLFOR($Action.Attachment.Download,Attachments.id)}" target="blank">
Preview
</apex:outputLink>
</li>
</ul>
</apex:repeat>
</div>
</apex:page>

 Thanks for any help

Hi All,

 

I try to send the param from Visualforce page to my controller I just want to deleted my record from list

 

 

List has no rows for assignment to SObject

Error is in expression '{!removePayment}' in component <apex:page> in page welcomecustomerportal


An unexpected error has occurred. Your development organization has been notified.

 

My Visualforce Page:

<apex:repeat value="{!lstAuthContacts}" var="AC">
  <apex:outputField value="{!AC.Name}"/>
  <apex:outputField value="{!AC.Contact_Type__c}"/>
   
  <apex:form>
   <apex:commandLink value="Remove" action="{!removeContact}">
    <apex:param name="delContact" value="{!AC.Id}" assignTo="{!cParam}"></apex:param>
   </apex:commandLink>
  </apex:form>

 

My Controller:

 

public class AccountProfileController {

    public list<Contact> lstAuthContacts{get;set;}
	public AccountProfileController(){
		getlstAuthContacts();			
	}    
	public void getlstAuthContacts(){    	
    	lstAuthContacts = [Select	Contact.Id,
                                        Contact.Name,
                                        Contact.Contact_Type__c,
                           From	        Contact
                           Where	Contact.AccountId = ::ApexPages.currentPage().getParameters().get('id')
                           And		Contact.Contact_Type__c = 'Authorized Contact'];
    	
    }

    public string cParam{get; set;}
    public PageReference removeContact(){
    	if(cParam != null || cParam != ''){
        Contact contact = [select Id from Contact where id=:cParam];            
        delete contact; 
    	}else{
    		system.assertEquals('removeContact', 'ContactId = '+cParam);
    	}    
        return null;
    }    
}

 

It's work, my record is deleted but on visualforce is Show the error around 5 minute, after that I refresh agian it work agian

 

What going on?

 

 

Dear All,

I have setup single sing-on with my website to have access to SFDC customer portal,

I want to show the URL with my website URL, not SFDC URL.

do you have any suggestion?


Thank for your kindness,

Apple

Hi There,

 

I'm using visualforce page to specify to email address to send email and should be attached file, 

 

I want create from to send to anyone and can keep tracking to Activity History of Contact belong to this document.

 

 

SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []

 

public with sharing class paymenthistoryCls {  
	
	public string uid;
	public string aid;
	public string cid; 
	public User objUser{get;set;}
	public list<Document__c> lstDocument{get;set;}
	public String DocId{get; set;}
    public String attId{get;set;}
    public String addresses{ get; set;}	
    	
	public paymenthistoryCls(){
		uid = Apexpages.currentPage().getParameters().get('id');//UserInfo.getUserId();
		getObjUser();
		getlstDocument();
	} 
	
	public void getObjUser(){
		if(uid != null){
		objUser = [Select 	User.ContactId,
							User.AccountId,
							User.UserType
	   				From	User
	   				Where	User.Id = :uid ];
	   	aid = objUser.AccountId;
	   	cid = objUser.ContactId;	
		}
	}
	
	public void getlstDocument(){
	lstDocument = [	SELECT	Document__c.Id,
	    							Document__c.Name,
	    							Document__c.Document_Name__c,
	    							Document__c.Description__c,
	    							Document__c.CreatedDate,
	    							Document__c.LastModifiedDate,
	    							(SELECT Document_Version__c.Id
	    							FROM	Document_Version__r)
	    					FROM	Document__c
	    					Where	Document__c.Account__c = :aid];
	}
	    
    public PageReference send() {
        PageReference pageReference =  ApexPages.currentPage();        
    	Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
        
        // Create the email attachment
       
		List<Messaging.EmailFileAttachment> efas = new List<Messaging.EmailFileAttachment>();
		
   	    for(Attachment a : [select	Attachment.Id,
	   	    						Attachment.Name,  
	   	    						Attachment.Body 
	   	    			 	from 	Attachment 
	   	    			 	where 	Attachment.ParentId = :attId]){
    	
	    	Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
	    	efa.setFileName(a.Name);
	    	efa.setBody(a.body);
			efas.add(efa);
   	   }
   	   String[] toAddresses;
   	   if(addresses != ''){
		toAddresses = addresses.split(';', 0);	
   	   }
   	   EmailTemplate Temp = [Select EmailTemplate.Id , EmailTemplate.Name From EmailTemplate Where Name = 'Portal: Send Document'];
		
        email.setTargetObjectId(cid);        
        email.setSaveAsActivity(false);       
        email.setTemplateId(Temp.id);
        email.setToAddresses( toAddresses );        
        email.setFileAttachments(efas);
        email.setWhatId(attid);
		
	Messaging.SendEmailResult[] results = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
	system.debug('result size ='+ results.size());
	ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,  'Email has been resent successfully '+results.size()+'.'+attId));
		return ApexPages.currentPage();
    }
}

 

23.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
02:46:06.031 (31183000)|EXECUTION_STARTED
02:46:06.031 (31240000)|CODE_UNIT_STARTED|[EXTERNAL]|066W00000008eni|VF: /apex/paymenthistory
02:46:06.032 (32175000)|VF_DESERIALIZE_VIEWSTATE_BEGIN|066W00000008eni
02:46:06.042 (42671000)|VF_DESERIALIZE_VIEWSTATE_END
02:46:06.043 (43632000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls get(lstDocument)
02:46:06.043 (43658000)|SYSTEM_MODE_ENTER|true
02:46:06.043 (43688000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|lstDocument
02:46:06.043 (43727000)|METHOD_ENTRY|[1]|01pW0000000D4RH|paymenthistoryCls.paymenthistoryCls()
02:46:06.043 (43828000)|SYSTEM_MODE_ENTER|false
02:46:06.043 (43840000)|SYSTEM_MODE_EXIT|false
02:46:06.043 (43850000)|METHOD_EXIT|[1]|paymenthistoryCls
02:46:06.043 (43862000)|CODE_UNIT_FINISHED|lstDocument
02:46:06.043 (43869000)|CODE_UNIT_FINISHED|paymenthistoryCls get(lstDocument)
02:46:06.054 (54757000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls get(addresses)
02:46:06.054 (54783000)|SYSTEM_MODE_ENTER|true
02:46:06.054 (54797000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|addresses
02:46:06.054 (54814000)|CODE_UNIT_FINISHED|addresses
02:46:06.054 (54820000)|CODE_UNIT_FINISHED|paymenthistoryCls get(addresses)
02:46:06.057 (57496000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57512000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57526000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57573000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57581000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57659000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57677000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57689000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57710000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57717000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57784000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.057 (57797000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57807000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.057 (57826000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.057 (57834000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.057 (57896000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57909000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57919000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57939000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57946000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.058 (58011000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58025000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58035000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58054000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58061000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58124000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58137000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58147000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58171000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58179000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58244000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58257000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58267000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58286000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58293000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58355000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58368000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58378000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58398000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58405000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58470000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58482000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58492000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58511000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58518000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58581000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58593000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58606000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58625000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58632000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58713000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58726000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58736000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58755000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58762000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58826000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58838000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58849000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58868000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58875000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58940000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58953000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58963000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58982000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58989000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.059 (59052000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59065000)|SYSTEM_MODE_ENTER|true
02:46:06.059 (59076000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59095000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59102000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.060 (60968000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls invoke(send)
02:46:06.061 (61059000)|SYSTEM_MODE_ENTER|false
02:46:06.061 (61102000)|SYSTEM_METHOD_ENTRY|[44]|ApexPages.currentPage()
02:46:06.061 (61242000)|SYSTEM_METHOD_EXIT|[44]|ApexPages.currentPage()
02:46:06.062 (62232000)|SYSTEM_CONSTRUCTOR_ENTRY|[49]|<init>()
02:46:06.062 (62266000)|SYSTEM_CONSTRUCTOR_EXIT|[49]|<init>()
02:46:06.062 (62306000)|METHOD_ENTRY|[51]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.062 (62343000)|METHOD_EXIT|[51]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.063 (63343000)|SOQL_EXECUTE_BEGIN|[51]|Aggregations:0|select Attachment.Id, Attachment.Name, Attachment.Body from Attachment 
02:46:06.118 (118130000)|SOQL_EXECUTE_END|[51]|Rows:1
02:46:06.118 (118256000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocator.iterator()
02:46:06.118 (118449000)|SYSTEM_METHOD_ENTRY|[7]|QueryLocatorIterator.QueryLocatorIterator()
02:46:06.118 (118464000)|SYSTEM_METHOD_EXIT|[7]|QueryLocatorIterator
02:46:06.118 (118627000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocator.iterator()
02:46:06.118 (118648000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118748000)|SYSTEM_METHOD_ENTRY|[33]|LIST<Attachment>.size()
02:46:06.118 (118784000)|SYSTEM_METHOD_EXIT|[33]|LIST<Attachment>.size()
02:46:06.118 (118804000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118815000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.next()
02:46:06.118 (118830000)|SYSTEM_METHOD_ENTRY|[48]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118852000)|SYSTEM_METHOD_ENTRY|[33]|LIST<Attachment>.size()
02:46:06.118 (118861000)|SYSTEM_METHOD_EXIT|[33]|LIST<Attachment>.size()
02:46:06.118 (118869000)|SYSTEM_METHOD_EXIT|[48]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118909000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.next()
02:46:06.119 (119249000)|SYSTEM_METHOD_ENTRY|[60]|LIST<Messaging.EmailFileAttachment>.add(Object)
02:46:06.119 (119285000)|SYSTEM_METHOD_EXIT|[60]|LIST<Messaging.EmailFileAttachment>.add(Object)
02:46:06.119 (119294000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.119 (119306000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.119 (119325000)|METHOD_ENTRY|[63]|01pW0000000D4RH|paymenthistoryCls.__sfdc_addresses()
02:46:06.119 (119356000)|METHOD_EXIT|[63]|01pW0000000D4RH|paymenthistoryCls.__sfdc_addresses()
02:46:06.119 (119776000)|SOQL_EXECUTE_BEGIN|[66]|Aggregations:0|select EmailTemplate.Id, EmailTemplate.Name from EmailTemplate where Name = 'Portal: Send Document'
02:46:06.122 (122867000)|SOQL_EXECUTE_END|[66]|Rows:1
02:46:06.123 (123431000)|METHOD_ENTRY|[73]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.123 (123457000)|METHOD_EXIT|[73]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.123 (123567000)|SYSTEM_CONSTRUCTOR_ENTRY|[75]|<init>()
02:46:06.123 (123595000)|SYSTEM_CONSTRUCTOR_EXIT|[75]|<init>()
02:46:06.123 (123617000)|SYSTEM_METHOD_ENTRY|[75]|LIST<Messaging.SingleEmailMessage>.add(Object)
02:46:06.123 (123631000)|SYSTEM_METHOD_EXIT|[75]|LIST<Messaging.SingleEmailMessage>.add(Object)
02:46:06.123 (123683000)|SYSTEM_METHOD_ENTRY|[75]|Messaging.sendEmail(LIST<Messaging.Email>)
02:46:06.183 (183772000)|EXCEPTION_THROWN|[75]|System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []
02:46:06.184 (184625000)|SYSTEM_METHOD_EXIT|[75]|Messaging.sendEmail(LIST<Messaging.Email>)
02:46:06.184 (184655000)|SYSTEM_MODE_EXIT|false
02:46:06.184 (184741000)|FATAL_ERROR|System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []

Class.paymenthistoryCls.send: line 75, column 1
02:46:06.184 (184764000)|CODE_UNIT_FINISHED|paymenthistoryCls invoke(send)

 

 

 

 

 

Hi There,

 

I'm using visualforce page to specify to email address to send email and should be attached file, 

 

I want create from to send to anyone and can keep tracking to Activity History of Contact belong to this document.

 

 

SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []

 

public with sharing class paymenthistoryCls {  
	
	public string uid;
	public string aid;
	public string cid; 
	public User objUser{get;set;}
	public list<Document__c> lstDocument{get;set;}
	public String DocId{get; set;}
    public String attId{get;set;}
    public String addresses{ get; set;}	
    	
	public paymenthistoryCls(){
		uid = Apexpages.currentPage().getParameters().get('id');//UserInfo.getUserId();
		getObjUser();
		getlstDocument();
	} 
	
	public void getObjUser(){
		if(uid != null){
		objUser = [Select 	User.ContactId,
							User.AccountId,
							User.UserType
	   				From	User
	   				Where	User.Id = :uid ];
	   	aid = objUser.AccountId;
	   	cid = objUser.ContactId;	
		}
	}
	
	public void getlstDocument(){
	lstDocument = [	SELECT	Document__c.Id,
	    							Document__c.Name,
	    							Document__c.Document_Name__c,
	    							Document__c.Description__c,
	    							Document__c.CreatedDate,
	    							Document__c.LastModifiedDate,
	    							(SELECT Document_Version__c.Id
	    							FROM	Document_Version__r)
	    					FROM	Document__c
	    					Where	Document__c.Account__c = :aid];
	}
	    
    public PageReference send() {
        PageReference pageReference =  ApexPages.currentPage();        
    	Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
        
        // Create the email attachment
       
		List<Messaging.EmailFileAttachment> efas = new List<Messaging.EmailFileAttachment>();
		
   	    for(Attachment a : [select	Attachment.Id,
	   	    						Attachment.Name,  
	   	    						Attachment.Body 
	   	    			 	from 	Attachment 
	   	    			 	where 	Attachment.ParentId = :attId]){
    	
	    	Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
	    	efa.setFileName(a.Name);
	    	efa.setBody(a.body);
			efas.add(efa);
   	   }
   	   String[] toAddresses;
   	   if(addresses != ''){
		toAddresses = addresses.split(';', 0);	
   	   }
   	   EmailTemplate Temp = [Select EmailTemplate.Id , EmailTemplate.Name From EmailTemplate Where Name = 'Portal: Send Document'];
		
        email.setTargetObjectId(cid);        
        email.setSaveAsActivity(false);       
        email.setTemplateId(Temp.id);
        email.setToAddresses( toAddresses );        
        email.setFileAttachments(efas);
        email.setWhatId(attid);
		
	Messaging.SendEmailResult[] results = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
	system.debug('result size ='+ results.size());
	ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,  'Email has been resent successfully '+results.size()+'.'+attId));
		return ApexPages.currentPage();
    }
}

 

23.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
02:46:06.031 (31183000)|EXECUTION_STARTED
02:46:06.031 (31240000)|CODE_UNIT_STARTED|[EXTERNAL]|066W00000008eni|VF: /apex/paymenthistory
02:46:06.032 (32175000)|VF_DESERIALIZE_VIEWSTATE_BEGIN|066W00000008eni
02:46:06.042 (42671000)|VF_DESERIALIZE_VIEWSTATE_END
02:46:06.043 (43632000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls get(lstDocument)
02:46:06.043 (43658000)|SYSTEM_MODE_ENTER|true
02:46:06.043 (43688000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|lstDocument
02:46:06.043 (43727000)|METHOD_ENTRY|[1]|01pW0000000D4RH|paymenthistoryCls.paymenthistoryCls()
02:46:06.043 (43828000)|SYSTEM_MODE_ENTER|false
02:46:06.043 (43840000)|SYSTEM_MODE_EXIT|false
02:46:06.043 (43850000)|METHOD_EXIT|[1]|paymenthistoryCls
02:46:06.043 (43862000)|CODE_UNIT_FINISHED|lstDocument
02:46:06.043 (43869000)|CODE_UNIT_FINISHED|paymenthistoryCls get(lstDocument)
02:46:06.054 (54757000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls get(addresses)
02:46:06.054 (54783000)|SYSTEM_MODE_ENTER|true
02:46:06.054 (54797000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|addresses
02:46:06.054 (54814000)|CODE_UNIT_FINISHED|addresses
02:46:06.054 (54820000)|CODE_UNIT_FINISHED|paymenthistoryCls get(addresses)
02:46:06.057 (57496000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57512000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57526000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57573000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57581000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,medemaza@gmail.com)
02:46:06.057 (57659000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57677000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57689000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57710000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57717000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxGMAW)
02:46:06.057 (57784000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.057 (57797000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57807000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.057 (57826000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.057 (57834000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.057 (57896000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57909000)|SYSTEM_MODE_ENTER|true
02:46:06.057 (57919000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57939000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.057 (57946000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxBMAW)
02:46:06.058 (58011000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58025000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58035000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58054000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58061000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58124000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58137000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58147000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58171000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58179000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJx6MAG)
02:46:06.058 (58244000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58257000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58267000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58286000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58293000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58355000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58368000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58378000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58398000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58405000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwhMAG)
02:46:06.058 (58470000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58482000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58492000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58511000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58518000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58581000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58593000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58606000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58625000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58632000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwmMAG)
02:46:06.058 (58713000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58726000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58736000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58755000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58762000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58826000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58838000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58849000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58868000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58875000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJxLMAW)
02:46:06.058 (58940000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58953000)|SYSTEM_MODE_ENTER|true
02:46:06.058 (58963000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(addresses,)
02:46:06.058 (58982000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.058 (58989000)|CODE_UNIT_FINISHED|paymenthistoryCls set(addresses,)
02:46:06.059 (59052000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59065000)|SYSTEM_MODE_ENTER|true
02:46:06.059 (59076000)|CODE_UNIT_STARTED|[EXTERNAL]|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59095000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.059 (59102000)|CODE_UNIT_FINISHED|paymenthistoryCls set(attId,a0VW0000000EJwwMAG)
02:46:06.060 (60968000)|CODE_UNIT_STARTED|[EXTERNAL]|01pW0000000D4RH|paymenthistoryCls invoke(send)
02:46:06.061 (61059000)|SYSTEM_MODE_ENTER|false
02:46:06.061 (61102000)|SYSTEM_METHOD_ENTRY|[44]|ApexPages.currentPage()
02:46:06.061 (61242000)|SYSTEM_METHOD_EXIT|[44]|ApexPages.currentPage()
02:46:06.062 (62232000)|SYSTEM_CONSTRUCTOR_ENTRY|[49]|<init>()
02:46:06.062 (62266000)|SYSTEM_CONSTRUCTOR_EXIT|[49]|<init>()
02:46:06.062 (62306000)|METHOD_ENTRY|[51]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.062 (62343000)|METHOD_EXIT|[51]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.063 (63343000)|SOQL_EXECUTE_BEGIN|[51]|Aggregations:0|select Attachment.Id, Attachment.Name, Attachment.Body from Attachment 
02:46:06.118 (118130000)|SOQL_EXECUTE_END|[51]|Rows:1
02:46:06.118 (118256000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocator.iterator()
02:46:06.118 (118449000)|SYSTEM_METHOD_ENTRY|[7]|QueryLocatorIterator.QueryLocatorIterator()
02:46:06.118 (118464000)|SYSTEM_METHOD_EXIT|[7]|QueryLocatorIterator
02:46:06.118 (118627000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocator.iterator()
02:46:06.118 (118648000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118748000)|SYSTEM_METHOD_ENTRY|[33]|LIST<Attachment>.size()
02:46:06.118 (118784000)|SYSTEM_METHOD_EXIT|[33]|LIST<Attachment>.size()
02:46:06.118 (118804000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118815000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.next()
02:46:06.118 (118830000)|SYSTEM_METHOD_ENTRY|[48]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118852000)|SYSTEM_METHOD_ENTRY|[33]|LIST<Attachment>.size()
02:46:06.118 (118861000)|SYSTEM_METHOD_EXIT|[33]|LIST<Attachment>.size()
02:46:06.118 (118869000)|SYSTEM_METHOD_EXIT|[48]|Database.QueryLocatorIterator.hasNext()
02:46:06.118 (118909000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.next()
02:46:06.119 (119249000)|SYSTEM_METHOD_ENTRY|[60]|LIST<Messaging.EmailFileAttachment>.add(Object)
02:46:06.119 (119285000)|SYSTEM_METHOD_EXIT|[60]|LIST<Messaging.EmailFileAttachment>.add(Object)
02:46:06.119 (119294000)|SYSTEM_METHOD_ENTRY|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.119 (119306000)|SYSTEM_METHOD_EXIT|[51]|Database.QueryLocatorIterator.hasNext()
02:46:06.119 (119325000)|METHOD_ENTRY|[63]|01pW0000000D4RH|paymenthistoryCls.__sfdc_addresses()
02:46:06.119 (119356000)|METHOD_EXIT|[63]|01pW0000000D4RH|paymenthistoryCls.__sfdc_addresses()
02:46:06.119 (119776000)|SOQL_EXECUTE_BEGIN|[66]|Aggregations:0|select EmailTemplate.Id, EmailTemplate.Name from EmailTemplate where Name = 'Portal: Send Document'
02:46:06.122 (122867000)|SOQL_EXECUTE_END|[66]|Rows:1
02:46:06.123 (123431000)|METHOD_ENTRY|[73]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.123 (123457000)|METHOD_EXIT|[73]|01pW0000000D4RH|paymenthistoryCls.__sfdc_attId()
02:46:06.123 (123567000)|SYSTEM_CONSTRUCTOR_ENTRY|[75]|<init>()
02:46:06.123 (123595000)|SYSTEM_CONSTRUCTOR_EXIT|[75]|<init>()
02:46:06.123 (123617000)|SYSTEM_METHOD_ENTRY|[75]|LIST<Messaging.SingleEmailMessage>.add(Object)
02:46:06.123 (123631000)|SYSTEM_METHOD_EXIT|[75]|LIST<Messaging.SingleEmailMessage>.add(Object)
02:46:06.123 (123683000)|SYSTEM_METHOD_ENTRY|[75]|Messaging.sendEmail(LIST<Messaging.Email>)
02:46:06.183 (183772000)|EXCEPTION_THROWN|[75]|System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []
02:46:06.184 (184625000)|SYSTEM_METHOD_EXIT|[75]|Messaging.sendEmail(LIST<Messaging.Email>)
02:46:06.184 (184655000)|SYSTEM_MODE_EXIT|false
02:46:06.184 (184741000)|FATAL_ERROR|System.EmailException: SendEmail failed. First exception on row 0; first error: INVALID_EMAIL_ADDRESS, email address has bounced for id : 003W000000CRfYr: []

Class.paymenthistoryCls.send: line 75, column 1
02:46:06.184 (184764000)|CODE_UNIT_FINISHED|paymenthistoryCls invoke(send)

 

 

 

 

 

Hi All,

 

I have Visualforce Page to list the case and have function to send email with attachment below the cases but I got the error like this:

 

Attempt to de-reference a null object

Error is in expression '{!send}' in component <apex:page> in page sendemailpage
 
public class outboundMessage {
	
    public Id cid;
    public Contact contact;
    public list<Case> cases {get; set;}
    public String attId{get;set;}
    public String addresses{ get; set;}

    // Create a constructor that populates the Account object 
    
    public outboundMessage() {
    	cid = ApexPages.currentPage().getParameters().get('id');
    	getContact();
    	getCases();        
    }
	
    public void getContact() {
    	contact = [Select	Contact.Id,
				Contact.Name,
				Contact.FirstName,
				Contact.LastName,
				Contact.Phone,
				Contact.Email,
				Contact.MailingStreet,
   				Contact.MailingCity,
   				Contact.MailingState,
   				Contact.MailingPostalCode,
   				Contact.MailingCountry
   		    From	Contact
                    WHERE       Contact.Id = :cid];
    }
    
    public void getCases(){
    	if(cid != null){
    	cases = [Select	Case.Id,
			Case.CaseNumber,
			Case.Subject,
			Case.CreatedDate,
			Case.Description,
			Case.ClosedDate,
   			(SELECT	Attachment.Id, Attachment.Name	    					 
			FROM	Case.Attachments)
    		From	Case
    		Where	Case.ContactId = :cid];
    	}
    }
    
	public String attstrMessage{
        get{
             if(attstrMessage != null){
                return  attstrMessage;
              }else{
                  return '';
              }          
         }
          private set;
        } 
         
    public PageReference send() {
    	PageReference pageReference =  ApexPages.currentPage();        
    	try{
    	Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage(); 
        
        List<Messaging.EmailFileAttachment> efas = new List<Messaging.EmailFileAttachment>();
		
   	    for(Attachment a : [select	Attachment.Id,
   	    				Attachment.Name,  
   	    				Attachment.Body 
   	    			from 	Attachment 
   	    			where 	Attachment.Id = :attId]){
    	
	    	Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
	    	efa.setFileName(a.Name);
	    	efa.setBody(a.body);
			efas.add(efa);
   	   }
		
		String[] toAddresses = addresses.split(':', 0);	
		
        // Sets the paramaters of the email 
    
        email.setTargetObjectId(cid);        
        email.setSaveAsActivity(false);       
        email.setTemplateId('00X90000000fCao');
        email.setToAddresses( toAddresses );        
        email.setFileAttachments(efas);
		
	Messaging.SendEmailResult[] results = Messaging.sendEmail(new Messaging.SingleEmailMessage[] { email });
	        if (results[0].isSuccess()) {
	               if(efas.size() > 0){
	                    pageReference.getParameters().put('message',' Email has been resent successfully with attachments.');
	               }else{
	                pageReference.getParameters().put('message',' Email has been resent successfully .');
	               }
	               attstrMessage=''; 	                      
	         } else {
	             ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,  'Failed to resend Email.'));
	             pageReference.getParameters().put('messagefail',' Failed to resend Email.');
	         }
	         ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.CONFIRM,  'Email has been resent successfully '+attstrMessage+'.'));
		}catch(System.EmailException ex ){
             system.debug('============== email exception caught!!!============='+ex.getMessage());
              pageReference.getParameters().put('messagefail',' Failed to resend Email.');
              ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,  'Failed to resend Email.'));
        }
		return ApexPages.currentPage();
    }
}

 

 
<apex:page showHeader="false" standardStylesheets="false" sidebar="false" Controller="outboundMessage" >
<apex:messages />
	
	<apex:repeat value="{!cases}" var="c">
    	<ul class="your-docs docs">
        <li  class="your-doc doc">
           <h4 class="doc-title">
           	<apex:outputText value="{!c.CaseNumber}"/> <apex:outputText value="{!c.Subject}"/>&raquo;
           </h4>
           <div class="doc-desc">{!c.Description}</div>
		<div class="record" id="recordEmail">
			<div class="data-wrapper">
				<ul class="doc-operations">
				<li>Edit</li>
		               	<li class="operations"><a href="#">Email</a></li>
		               	<li>Print</li>
				</ul>
			</div>
			<div class="form-wrapper">
				<apex:form >
					<apex:outputLabel value="email" for="Addressed"/>:
					<apex:inputText value="{!addresses}" id="addresses" maxlength="80"/>			<apex:repeat value="{!c.Attachments}" var="att">							 
					attachment name: <apex:outputText value="{!att.name}"/>
					<div class="form-actions">
                        	            <button class="cancel">Cancel</button>
					    <apex:commandButton value="Send Email" action="{!send}" styleClass="button-medium">
					    <apex:param name="attSend" value="{!att.Id}" assignTo="{!attId}"></apex:param>	
					   </apex:commandButton>
		                        </div>
					</apex:repeat>	 
				    </apex:form>
				</div>
			</div>
		</li>
		</ul>
	</apex:repeat>	
</apex:page>

 

20.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
15:31:42.014 (14629000)|EXECUTION_STARTED
15:31:42.014 (14672000)|CODE_UNIT_STARTED|[EXTERNAL]|06690000001qGv5|VF: /apex/sendEmailPage
15:31:42.014 (14890000)|VF_DESERIALIZE_VIEWSTATE_BEGIN|06690000001qGv5
15:31:42.029 (29723000)|VF_DESERIALIZE_VIEWSTATE_END
15:31:42.030 (30622000)|CODE_UNIT_STARTED|[EXTERNAL]|01p90000001ziVK|outboundMessage get(cases)
15:31:42.030 (30640000)|SYSTEM_MODE_ENTER|true
15:31:42.030 (30660000)|CODE_UNIT_STARTED|[EXTERNAL]|01p90000001ziVK|cases
15:31:42.030 (30697000)|METHOD_ENTRY|[1]|01p90000001ziVK|outboundMessage.outboundMessage()
15:31:42.030 (30794000)|METHOD_EXIT|[1]|outboundMessage
15:31:42.030 (30808000)|CODE_UNIT_FINISHED|cases
15:31:42.030 (30819000)|CODE_UNIT_FINISHED|outboundMessage get(cases)
15:31:42.037 (37406000)|CODE_UNIT_STARTED|[EXTERNAL]|01p90000001ziVK|outboundMessage invoke(send)
15:31:42.037 (37501000)|SYSTEM_METHOD_ENTRY|[60]|ApexPages.currentPage()
15:31:42.037 (37589000)|SYSTEM_METHOD_EXIT|[60]|ApexPages.currentPage()
15:31:42.038 (38499000)|SYSTEM_CONSTRUCTOR_ENTRY|[66]|<init>()
15:31:42.038 (38530000)|SYSTEM_CONSTRUCTOR_EXIT|[66]|<init>()
15:31:42.038 (38564000)|METHOD_ENTRY|[68]|01p90000001ziVK|outboundMessage.__sfdc_attId()
15:31:42.038 (38595000)|METHOD_EXIT|[68]|01p90000001ziVK|outboundMessage.__sfdc_attId()
15:31:42.038 (38890000)|SOQL_EXECUTE_BEGIN|[68]|Aggregations:0|select Attachment.Id, Attachment.Name, Attachment.Body from Attachment 
15:31:42.044 (44173000)|SOQL_EXECUTE_END|[68]|Rows:0
15:31:42.044 (44229000)|SYSTEM_METHOD_ENTRY|[68]|Database.QueryLocator.iterator()
15:31:42.044 (44327000)|SYSTEM_METHOD_ENTRY|[7]|QueryLocatorIterator.QueryLocatorIterator()
15:31:42.044 (44341000)|SYSTEM_METHOD_EXIT|[7]|QueryLocatorIterator
15:31:42.044 (44401000)|SYSTEM_METHOD_EXIT|[68]|Database.QueryLocator.iterator()
15:31:42.044 (44417000)|SYSTEM_METHOD_ENTRY|[68]|Database.QueryLocatorIterator.hasNext()
15:31:42.044 (44436000)|SYSTEM_METHOD_EXIT|[68]|Database.QueryLocatorIterator.hasNext()
15:31:42.044 (44453000)|METHOD_ENTRY|[80]|01p90000001ziVK|outboundMessage.__sfdc_addresses()
15:31:42.044 (44478000)|METHOD_EXIT|[80]|01p90000001ziVK|outboundMessage.__sfdc_addresses()
15:31:42.044 (44514000)|EXCEPTION_THROWN|[80]|System.NullPointerException: Attempt to de-reference a null object
15:31:42.046 (46629000)|FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object

Class.outboundMessage.send: line 80, column 1
15:31:42.046 (46641000)|CODE_UNIT_FINISHED|outboundMessage invoke(send)

 

Thank for any help ! ! !

 
 
 
 
 

Dear Expert,

I am trying to Pass parameter to Apex method from VF page.It work for remove But i am not able to get the parameter value for update.

 

<apex:repeat value="{!lstAuthContacts}" var="AC">
 <apex:form >
 <apex:commandLink value="Remove" action="{!removeContact}">
   <apex:param name="delContact" value="{!AC.Id}" assignTo="{!cParam}"></apex:param>
 </apex:commandLink>

<label>First name*</label>
<apex:inputField value="{!AC.FirstName}" styleClass="form-text" id="form-text-contact-first-name"/>

<label>Last name*</label>
<apex:inputField value="{!AC.LastName}" styleClass="form-text" id="form-text-contact-last-name"/>
<label>Phone*</label>
<apex:inputField value="{!AC.Phone}" styleClass="form-text" id="form-text-contact-phone"/>
<label>Email address*</label>
<apex:inputField value="{!AC.Email}" styleClass="form-text" id="form-text-contact-email"/>

<apex:commandButton action="{!updateAuthContact}" value="Save updates" id="theButton"> <apex:param name="updateContact" value="{!AC.Id}" assignTo="{!cParam}"></apex:param> </apex:commandButton>
</apex:form>
</apex:repeat>

 

 

public with sharing class AccountProfileController {
public Id aid {get;set;}
public string cParam{get;set;} public list<Contact> lstAuthContacts{get;set;} public AccountProfileController(){ getlstAuthContacts(); } private void getlstAuthContacts(){ aid = Apexpages.currentPage().getParameters().get('id'); if(aid != ''){ lstAuthContacts = [Select Contact.Id, Contact.Name, Contact.Contact_Type__c, Contact.FirstName, Contact.LastName, Contact.Phone, Contact.Email, Contact.MailingStreet, Contact.MailingCity, Contact.MailingState, Contact.MailingPostalCode, Contact.MailingCountry, Contact.Living_Will__c From Contact Where Contact.AccountId = :aid And Contact.Contact_Type__c = 'Authorized Contact']; } }
public PageReference removeContact(){
if(cParam != ''){
Contact toDel=new Contact(id=cParam);
delete todel;
getlstAuthContacts
}
returm null;
}
public PageReference updateAuthContact() {
if(cParam != ''){
Contact toUpdate=new Contact(id=cParam);
update toUpdate;
getlstAuthContacts();
}
return null;
}
}



Hi All,

I have query my attachment from my custom object using Relationship Queries,

 

but I don't know how I can display my attachment ID , I got error  Save error: Unknown property 'VisualforceArrayList.id' 

 

 I have queries and VF page like this:

 

public class documentCls {
	public Id uid;
	public Integer counter{get;set;}
	public list<Document__c> lstDocument{get;set;}
	public list<Document_Version__c> lstDocVs{get;set;}
	public list<Attachment> Attach{get;set;}
	public documentCls(){
		getlstDocument();
		getlstDocVs();	
	}
	
	public void getlstDocument(){
		uid = UserInfo.getUserId();
    	if(uid != ''){ 
    		lstDocument = [	SELECT	Document__c.Id,
	    				Document__c.Name,
	    				Document__c.Document_Name__c,
	    				Document__c.Description__c
	    			FROM	Document__c
	    			Where	Document__c.OwnerId = :uid];
	    					
	    	counter = [	SELECT 	Count()
	    			FROM	Document__c
	    			Where	Document__c.OwnerId = :uid];
	    				
	    	System.debug('My counted records: ' + counter);  
    	}  	
    }
     public void getlstDocVs(){
    	if(lstDocument.size() > 0){
    		for(Document__c d:lstDocument){
    			
    			lstDocVs = [SELECT	Document_Version__c.Id,
Document_Version__c.Document__r.Document_Name__c, Document_Version__c.Document__r.Description__c, Document_Version__c.Document__r.CreatedDate, Document_Version__c.Document__r.LastModifiedDate, (SELECT Attachment.Id
FROM Document_Version__c.Attachments) FROM Document_Version__c WHERE Document_Version__c.Document__c = :d.id ORDER BY Document_Version__c.Document__r.CreatedDate DESC]; } }else{ system.debug('Document is null'); } } }

 

<apex:page showHeader="false" standardStylesheets="false" sidebar="false" Controller="documentCls">
<div class="tab-pane" id="your-documents">
<div class="doc-alert">You have {!counter} new document ready for download!</div>
<apex:repeat value="{!lstDocVs}" var="v">
<ul class="doc-steps">
<li>
<apex:outputText value="{!v.Document__r.Document_Name__c}"/>
<apex:outputLink value="{!URLFOR($Action.Attachment.Download,Attachments.id)}" target="blank">
Preview
</apex:outputLink>
</li>
</ul>
</apex:repeat>
</div>
</apex:page>

 Thanks for any help

Hi All,

 

I try to send the param from Visualforce page to my controller I just want to deleted my record from list

 

 

List has no rows for assignment to SObject

Error is in expression '{!removePayment}' in component <apex:page> in page welcomecustomerportal


An unexpected error has occurred. Your development organization has been notified.

 

My Visualforce Page:

<apex:repeat value="{!lstAuthContacts}" var="AC">
  <apex:outputField value="{!AC.Name}"/>
  <apex:outputField value="{!AC.Contact_Type__c}"/>
   
  <apex:form>
   <apex:commandLink value="Remove" action="{!removeContact}">
    <apex:param name="delContact" value="{!AC.Id}" assignTo="{!cParam}"></apex:param>
   </apex:commandLink>
  </apex:form>

 

My Controller:

 

public class AccountProfileController {

    public list<Contact> lstAuthContacts{get;set;}
	public AccountProfileController(){
		getlstAuthContacts();			
	}    
	public void getlstAuthContacts(){    	
    	lstAuthContacts = [Select	Contact.Id,
                                        Contact.Name,
                                        Contact.Contact_Type__c,
                           From	        Contact
                           Where	Contact.AccountId = ::ApexPages.currentPage().getParameters().get('id')
                           And		Contact.Contact_Type__c = 'Authorized Contact'];
    	
    }

    public string cParam{get; set;}
    public PageReference removeContact(){
    	if(cParam != null || cParam != ''){
        Contact contact = [select Id from Contact where id=:cParam];            
        delete contact; 
    	}else{
    		system.assertEquals('removeContact', 'ContactId = '+cParam);
    	}    
        return null;
    }    
}

 

It's work, my record is deleted but on visualforce is Show the error around 5 minute, after that I refresh agian it work agian

 

What going on?

 

 

Hi,

 

I am also having same problem.

i am trying to refresh my primary tab and close the subtab.

below is the code which i am trying to do.

could you please assist me on this, if you have any code samples please share with me.

 

How can we get the primary tab id.

 

function RefreshPrimaryTabByName() {

var primaryTabName = "{!Case.Contact.Name}";

sforce.console.refreshPrimaryTabByName(primaryTabN​ame, true, refreshSuccess,closeCurrTab());

}

var refreshSuccess = function refreshSuccess(result) {

if (result.success == true) {

//alert('Primary tab refreshed successfully');

} else {

//alert('Primary tab did not refresh');

}

};

function closeCurrTab() {

sforce.console.getEnclosingTabId(closeCurrTabById)​;

}

var closeCurrTabById = function closeCurrTabById(result) {

sforce.console.closeTab(result.id);

};

 

Thank you,

 

 

Hi All,

 

Question - I am using Apex with my Flow successfully enough, however challenge has arisen to gracefully close out the flow itself.

 

My Flow concludes with creation of a new record, however I cannot figure out how to pass the Id of the new record back to the VF page component so that the user can click to finish and then be taken to that new record i.e. how do I put a newly created account Id into the <flow:interview finishLocation="> account Id<" ?

 

Any suggestions most appreciated.

 

Cheers.