function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ben4817Ben4817 

Redirecting to a URL on Save without a controller

I have written a Visualforce page for support reps to verify basic account info before creating a case.  It is essentially the account edit page with only a few fields visible.  When the rep clicks Save, I want to create a new case with a few values being passed in the URL.  I can do it just fine with a controller, but I have discovered that with Enterprise edition, since we have purchased it and are not using a trial, we can only write controllers in a Sandbox, not our production environment.  Does anyone know how I could make the Save button perform a standard save action and then redirect to a new URL strictly in the Visualforce page?  Please see my code below:

<apex:page standardcontroller="Account" tabStyle="Case">
  <apex:form >
    <apex:pageBlock title="Hello {!$User.FirstName}!" mode="edit">
        Please verify the following information with {!Account.Name}. <br/> <br/>
        <apex:pageMessages />
    </apex:pageBlock>
    <apex:pageBlock >
        <apex:pageBlockSection title="Contact details for {!Account.name}" columns="2">
            <apex:inputField value="{!Account.name}" required="false"/>
            <apex:inputField value="{!Account.phone}" required="true"/>
        </apex:pageBlockSection>
        <apex:pageBlockSection columns="1">
            <apex:inputField value="{!Account.BillingStreet}"/>
            <apex:inputField value="{!Account.BillingCity}"/>           
            <apex:inputField value="{!Account.BillingState}"/>    
            <apex:inputField value="{!Account.BillingPostalCode}"/>   
            <apex:inputField value="{!Account.BillingCountry}"/>                                                  
        </apex:pageBlockSection>
        <apex:pageBlockButtons location="bottom">
            <apex:commandButton value="Verified" action="{!save}"/>
        </apex:pageBlockButtons>
    </apex:pageBlock>
  </apex:form>
</apex:page>

yogesh.rankawatyogesh.rankawat
You should use javascript function on 'onclick' event of save button to redirect to a new URL as:

window.parent.location.href = 'http://.......' ;

:smileyhappy:

Ben4817Ben4817
Thanks for your comment.  I found a sample somewhere that gave me something else to try that worked well.  My addition is as follows:

        <apex:pageBlockButtons location="bottom">
            <apex:commandButton value="Verified" action="{!save}"
 oncomplete="window.parent.location.href='https://na3.salesforce.com/500/e?retURL=%2F{!Account.Id}&def_account_id={!Account.Id}&RecordType=0125000000018E8&cancelURL=%2F{!Account.Id}&ent=Case'"/>
        </apex:pageBlockButtons>