You need to sign in to do that
Don't have an account?
Snehal Gaware 15
not able to create record through vf page on object tab. getting error as "List has no rows for assignment to SObject ".
Hi i have created vf page and controller to override new button of custom object (Problem). So whenever i am able to create problem through case and it is working as expected. but when i am creating problem though it's tab i am getting error as : "List has no rows for assignment to SObject " . Please suggest.
controller :
controller :
public class Populate { public Case cs{get;set;} public SC_Problem_Management__c prblm{get;set;} public ApexPages.StandardController stdCntrlr {get; set;} public Populate(ApexPages.StandardController controller) { cs = new Case(); prblm = new SC_Problem_Management__c(); prblm = (SC_Problem_Management__c)controller.getRecord(); //Get the ID of Currently present case on vf page String csId = [SELECT Id FROM Case WHERE Id =: prblm.Case__c].Id; System.debug('testing'+ csId); prblm.Case__c= csId; if(csId != null) { //calling autofilling method autoCal(); } } //function is called from actionsupport event public void autoCal() { Id caseid = prblm.Case__c; // collecting case id from visualforce page List<Case> caseLst = [select id,Products__c,Componet__c ,Feature__c,Status,Priority,Subject,Description__c,Assignment_Group__c from Case where id=:caseid]; system.debug('Product'+ caseLst[0].Products__c); if(caseLst.isEmpty()) { return; } prblm.Products__c= caseLst[0].Products__c; prblm.Component__c = caseLst[0].Componet__c; prblm.Feature__c = caseLst[0].Feature__c; prblm.Status__c = caseLst[0].Status; prblm.Priority__c = caseLst[0].Priority; prblm.Title__c=caseLst[0].Subject; prblm.Issue_Escape__c=caseLst[0].Assignment_Group__c; prblm.Description__c= caseLst[0].Description__c; } public pagereference Save() { insert prblm; pagereference pr = new pagereference('/'+prblm.id); return pr; } }
Better create a seperate button with this VF page then include that in the related list and keep the new button (in the Problecm object tab) as such.
Thanks,
Govindaraj.S
Could you please suggest