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
Squire KershnerSquire Kershner 

Questions on Creating Record from Opportunity

So, the requirement is to create a record on a custom object, from Opportunity.  However, we do not want it to be a related record/list.

1)  I assume, since the resulting record is not related to the Opportunity, I can't just use a hacked URL button to build the record?
2)  I believe I'll have to use JavaScript (unless there's another option) to build the record?  I thought about trying to fire a class from a button click to do this, but I'm just not sure how far to go.
3)  If I do need to use JavaScript, can I have the new record open in a not-saved status, and more importantly, return to the Opportunity after save, or have I just made the entire script overly complex?

Thank you.
alibzafaralibzafar
Are you populating any data from Opportunity to new Object? Or is it just a link you want to create new record for Custom Object? If thats the case then you can have a custom Button on Opportunity with URL to create a new record, but after saving it will redirect you to New record detail page,  to redirect yourself to Opportunity, you need to overwrite Save functionalty for new Object. (probably write a custom VF page for that, with extension only overwriting save function )


Squire KershnerSquire Kershner
We are pulling some data from Opportunity to pre-populate the new record.  Overwriting the save functionality is way out of scope (and likely a bad idea anyway).
Karan Khanna 6Karan Khanna 6
If you want to open Opportunity detail page on Saving of another object record then I am afraid because I dont think there is any good option except overriding Save method. otherwise use JavaScript.