+ Start a Discussion
DevWannabeDevWannabe 

On-Click JavaScript NEW custom button

I have a button that creates a new record using javascript and will bring that new record up in edit mode, but it commits the record to the database prior to bringing it up in edit mode.  Is there a way to do this without committing the record to the database in case the user would like to cancel the creation or make additional manual changes to the record?  I have also been able to do the same function with a URL hack where it doesn't commit the record and brings it up in edit mode like a normal NEW button would.  However, there are some limitations to using the URL that I would like to avoid with the JavaScript button, but can't seem to get it to work without committing the record.

Suresh RaghuramSuresh Raghuram

when you are trying to create a record it will be saved in the database before it opens in a detail page or edit mode.

 

Then how can you expect a record to be opened in edit mode with out saving to the database.

 

If there is any such possibility please let me know.

Suresh RaghuramSuresh Raghuram

check with savepoint and rollback it may be possible 

Nimble TedNimble Ted

Use a Visualforce page, collect the details first using local fields, confirm, and then use the same details create the record. 

DevWannabeDevWannabe

Suree,

 

I am referencing when you create a record, i.e. "New [Object}" button, brings up the record in data entry (edit) mode.  For example when you are on an Account and you hit "New Contact" there are certain fields that get automatically populated from the Account and the user can input other data before committing the record to the database unless they change their mind and hit cancel then nothing is committed to the database.  When trying to use the Javascript button the way I am talking about when you click the button it brings the record up in edit mode, but it has already committed the record to the database so if you hit cancel at that point the record is still created and you would have to manually delete it if you didn't mean to create it.

 

I hope that explains it better, but let me know if it doesn't

DevWannabeDevWannabe

NT,

 

So, would you be able to use the standard controller with this approach or would you have to write something custom to handle that approach?