I would like to redirect users from my custom visualforce 'New Record' page to custom detail page passing an ID parameter while doing so. The current behavior, after creating the record the user will be shown the normal salesforce record detail page.
I have constructed some code for this but I am not sure if its correct, the first issue I get is with the extension:
Expression must be a list type: SOBJECT:Service_Order__c at line 6 column 80
UPDATE: Now page leads to the following issue
Error: Error occurred while loading a Visualforce page.
VF:
<apex:page showHeader="false" title="New Order" standardController="Service_Order__c" extensions="force_NewOrderLogic">
...
<apex:commandButton value="Create Order" action="{!save}" styleClass="btn btn-success" rerender="error,styledError,unstyledError"/>
Apex (updated):
public class force_NewOrderLogic {
public force_NewOrderLogic(ApexPages.StandardController controller) {
}
Service_Order__c order;
public PageReference save() {
insert order;
PageReference orderPage = new PageReference('/force_OrderDetail?id=' + order.id);
orderPage.setRedirect(true);
return orderPage;
}
}