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
John DeitzJohn Deitz 

Getting VF page to automatically Save/Close

I have a cusom page using the standard controller for a custom object.  I am passing in two fields in the URL invocation, and I simply want to Validate/Save the record and return (avoiding a user-initiated Save action).  How should I configure the apex page or form elements to accomplish that.
Dominic Blythe 18Dominic Blythe 18

Hi John.
So you pass parameters into the page, and then the page saves, without showing anything to the user?

If you want an action to take place as soon as the page loads, without the user having to do anything, you can create an Apex extension with an action method. Then call the action method by placing a reference to it in the VF page's apex:page tag. 

If your custom object is called Handbag__c :

 

<apex:page standardcontroller="Handbag__c" extensions="HandbagExtension" action="doAutomaticThing">
...
...

This assumes that you write an apex class called HandbagExtension that extends the Handbag__c standard controller, and include a method called doAutomaticThing that returns a PageReference. Either a null PageReference to stay on the same page, or a PageReference to the page you want to go to next.

 

 

hd sdhd sd
Whose is the possessive form of the pronoun who, on the equal time as who’s is a contraction of the words who is or who has. However, many people nevertheless locate whose and who’s specially complicated because, in English, an apostrophe followed by way of way of an s commonly suggests the possessive form of a word link (https://itabaghub.com/).