You need to sign in to do that
Don't have an account?
Btuitasi1
Insert record from custom object
I am trying to insert a record on a child object (Idea_Comments__c) of the standard controller object (Idea_Lobby__c). After insertion, I would also like it forward to a VF page. So far, I have not had any success with my page. After clicking submit, the page tries to send me to login.
Here's my extension so far:
Any ideas on how I can get this to work?
Here's my extension so far:
public with sharing class detExt { private ApexPages.StandardController theController; public Idea_Comments__c ideaCom {get; set;} public Idea_Comments__c setideaCom(Idea_Comments__c op){ this.ideaCom=op; return ideaCom; } public detExt(ApexPages.StandardController acon) { theController = acon; ideaCom=new Idea_Comments__c(); } public List<Idea_Comments__c> getdetExt() { ID masterID = theController.getID(); return [SELECT Id, CreatedDate, CreatedBy.Name, Comment__c FROM Idea_Comments__c WHERE Idea_Lobby__c = :masterID order by CreatedDate DESC ]; } public pagereference saveComments(){ Idea_Comments__c cd = new Idea_Comments__c(); cd.Comment__c=ideaCom.Comment__c; insert cd; PageReference congratsPage = Page.Congrats_Page; congratsPage.setRedirect(true); return congratsPage; } }
Any ideas on how I can get this to work?
All Answers
worked! Thanks!!