You need to sign in to do that
Don't have an account?

System.QueryException: List has no rows for assignment to SObject
Hi ,
Am creating a VF Page for New/Edit page for my CustomObject and With the Following Controller am getting:
Visualforce Error
System.QueryException: List has no rows for assignment to SObject
Class :
public class NewColorPaletteController{ public Color_Palette_To_Color__c record; public string b{get; set;} public NewColorPaletteController() { record= [select id,Name,Color_Palette__c,Color__c FROM Color_Palette_To_Color__c where id=:ApexPages.currentPage().getParameters().get('Id')]; } Public Color_Palette_To_Color__c getRecord() { return record; } Public PageReference SaveMethod(){ try{ update record; } catch(exception e){ // // handle the exception } return new PageReference('/apex/relatedListColorPalette?id='+record.Color_palette__c); } Public PageReference cancelMethod() { return null; } }
Please provide Solution for this Error.
-Thank you.
probably because there is no id passed in the url??
you can put a try catch around tthe soql if you dont want the error
All Answers
My VF page Code is below :
probably because there is no id passed in the url??
you can put a try catch around tthe soql if you dont want the error