I am working on a web2lead form which updates a record after it's submitted. I converted the web2lead to a visualforce page and I am trying to use a standard controller extension to update the record when it's submitted. But I am getting a Invalid Page Redirection error and I think it's because the apex form is not submitting to the right url. Below is my code:
VF:
<apex:page standardController="SVMXC__Service_Order__c" extensions="BEC_Web2LeadExtension" docType="html-5.0">
<apex:form html-action="https://test.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" html-method="POST">
<apex:commandButton value="submit" action="{!submitAndUpdate}"/>
</apex:form>
</apex:page>
Extension method:
public void submitAndUpdate(){
//controller.save();
SVMXC__Service_Order__c woRecUpdate = [select id, Submit_lead__c from SVMXC__Service_Order__c where Submit_lead__c = true and id=: woRec.id];
if(woRecUpdate != null){
woRecUpdate.Submit_lead__c = false;
update woRecUpdate;
}
So my question is how do I submit the form to the url and also update the record the form is submitted from?
Thanks in advance for any help!