function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
impalacrazy69impalacrazy69 

List has no rows for assignment

 

So im assuming that i am totally off in what i am trying to accomplish. So here we go:

 

I have a controller and within it a section that takes the fields from the VF page and pushes them into another set of fields on the same VF page (fired by a copy to command link on the VF page) all within the same object. So one of the fields i am pulling data from is Company_Country which is a picklist in my object and i want to pass the value of this(name) into another vield called Venue_Country (which is a lookup to a table called Country). Attached is the code i am working on but for some reason i get this errror in my debugger. Am i missing something since im passing a picklist value to a lookup

 

public PageReference getsameAddress (){ 
    	
 			this.request.Venue_Name__c = this.request.Company_Name__c;   	
        	this.request.Venue_Address__c = this.request.Company_Address__c;
       		this.request.Venue_City__c = this.request.Company_City__c;
       		this.request.Venue_Postal__c = this.request.Company_Postal__c;
       		
       		
       if (this.request.Company_Country__c != null){
       		this.request.Venue_Country2__c = [select Company_Country__c from Marketing_Request__c where Name=:this.request.Company_Country__c].Name;
       }
   			
       
       		this.request.Venue_State__c = this.request.Company_State__c;
   system.debug('in the getsameaddress method monkey balls');
   		return null;
    	
    } 
Avidev9Avidev9

Probably your soql is not returning any results

public PageReference getsameAddress (){ 
    	
 			this.request.Venue_Name__c = this.request.Company_Name__c;   	
        	this.request.Venue_Address__c = this.request.Company_Address__c;
       		this.request.Venue_City__c = this.request.Company_City__c;
       		this.request.Venue_Postal__c = this.request.Company_Postal__c;
       		
       		
       if (this.request.Company_Country__c != null){
       		this.request.Venue_Country2__c = [select Company_Country__c from Marketing_Request__c where Name=:this.request.Company_Country__c].Name;
       }
   			
       
       		this.request.Venue_State__c = this.request.Company_State__c;
   system.debug('in the getsameaddress method monkey balls');
   		return null;
    	
    } 

Well lets handle this

 

public PageReference getsameAddress (){ 
    	
 			this.request.Venue_Name__c = this.request.Company_Name__c;   	
        	this.request.Venue_Address__c = this.request.Company_Address__c;
       		this.request.Venue_City__c = this.request.Company_City__c;
       		this.request.Venue_Postal__c = this.request.Company_Postal__c;
       		
       		
       if (this.request.Company_Country__c != null){
       		
List<Marketing_Request__c> mr = [select Company_Country__c from Marketing_Request__c where Name=:this.request.Company_Country__c LIMIT 1];
if(!mr.isEmpty()){
this.request.Venue_Country2__c = mr[0].Name;
}
else{
//specify a logic here when no matches are found
} } this.request.Venue_State__c = this.request.Company_State__c; system.debug('in the getsameaddress method monkey balls'); return null; }