Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.
list<Temp_Invoice__c>  tempInvoice = [select id,First_Name__c,Last_Name__c,Email__c from Temp_Invoice__c limit 1];
 tempInvoice.First_Name__c = billing.billingfirstname;

getting error as Initial term of field expression must be a concrete SObject:List

share|improve this question
1  
Based on your comments to the answers given, I think it may be useful if you elaborate your question. What are you trying to do ? Current query won't guarantee you to predict which record is returned, are you sure you aren't simply in need of a new Temp_Invoice__c object instance ? –  Samuel De Rycke Nov 15 '12 at 12:52

2 Answers 2

if you're assigning to a list of invoices, you should be consistent ;)

list<Temp_Invoice__c>  tempInvoice = [select id,First_Name__c,Last_Name__c,Email__c from Temp_Invoice__c limit 1];
if(!tempInvoice.isEmpty()){
    tempInvoice[0].First_Name__c = billing.billingfirstname;
}

Note the [0]

share|improve this answer
    
You would want to check that the list isn't empty before doing that. –  Samuel De Rycke Nov 15 '12 at 12:26
    
then getting error as System.ListException: List index out of bounds: 0 Error is in expression '{!save}' in component <apex:page> –  Eagerin Sf Nov 15 '12 at 12:26
    
my list will be empty as it has no values in it –  Eagerin Sf Nov 15 '12 at 12:27

tempInvoice is a list<Temp_Invoice__c>, so if you need information from a specific member of that list, you need to identify which member you want, possibly through square brackets. This is true even if you happen to know that there is only one member in the list. For example:

tempInvoice[0].First_Name__c = billing.billingfirstname;
share|improve this answer
    
then getting error as System.ListException: List index out of bounds: 0 Error is in expression '{!save}' in component <apex:page> –  Eagerin Sf Nov 15 '12 at 12:46
    
That means there were no records returned from your query, and so the list is empty. What to do next depends on what you are trying to do. If you can add more detail to your Question that describes your goals, we can help better. –  Jeremy Nottingham Nov 15 '12 at 13:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.