You need to sign in to do that
Don't have an account?
Juul
Go to Thank you page after pressing Update
Hi ,
What do I need to change to refer to a thank you page after pressing the button "Update"?
Class:
public class UpdateCampaignMemberClass{
public final CampaignMember cm;
private ApexPages.StandardController cmController;
public UpdateCampaignMemberClass(ApexPages.StandardController controller) {
cmController = controller;
this.cm= (CampaignMember)controller.getRecord();
}
public PageReference UpdateAction() {
try{
update cm;
}
catch(DmlException ex){
ApexPages.addMessages(ex);
}
return new PageReference('http://test.force.com/web2campaign/?id=' + cm.id );
} public string getStatus(string Status){
return 'Test__c';
return 'Test_2__c';
}
}
VF:
<apex:page standardController="CampaignMember" extensions="UpdateCampaignMemberClass" sidebar="false" showHeader="false"> <script type="text/javascript"> function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } } function showAlert(variable){ alert(variable); } </script> <apex:form > <b>Campaign Member ID </b><apex:inputfield value="{!campaignmember.Id}"/><br/><br/> Status <apex:inputfield value="{!campaignmember.Test__c}"/><br/><br/> Status <apex:inputfield value="{!campaignmember.Test_2__c}"/><br/><br/> <apex:commandButton value="Update" action="{!UpdateAction}" /> </apex:form> </apex:page>
THis is the line which takes you to the next page
You have to update it to the new page some thing like "return Page.Thankyou"
All Answers
Did you posted the correct code ? Seems like the code is messed up due to some formatting issues. Can you post ti again?.
But anyways if you want to redirect to a page. You have to make sure that your action method returns pagereference to that page.
Sorry something went wrong with the copy paste action :)
I've edited my previous post. Where do I need to add your code?
Thanks
THis is the line which takes you to the next page
You have to update it to the new page some thing like "return Page.Thankyou"
Thanks, I thought that this line was necessary for a correct update!