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
lksmsbglksmsbg 

Create a new object instance with assigned values

Hopefully this is a simple question.  Looking to have a button on Contracts layout that will create a new instance of an Asset with assigned values.  Specifically the contract number and account name already populated based on the values (Account name and contract number) in the contract.

 

Current method in place will populate one of the numbers (but not both) and force the user to pick from a generated filtered search (Beta stuff under buttons).  Not bad for starters, however this leaves room for error and becomes very slow when number of accounts/contracts becomes large.

 

 

I am now starting down the VisualForce path to see if this is what I need to do

 

Suggestions?

 

Mr SlingMr Sling

We currently use a Case Custom Button that creates a new Product (Custom Object) which is linked to the Case.  We're trying to do the same thing you are, IE: create a new Case while viewing an Account's Products and link both the Product and Account to the Case.

 

I've seen several sites and posts with examples of how to do more of this via URL decoding, but haven't yet seen or figured out how to put 2 objects into the URL.  We currently use a Case Custom Button code that creates a new Product (Custom Object) from the Case Detail page. It's customized for our Object, but hopefully it'll help get you started.  If I figure out how both objects can be passed in the Custom Button I'll send an update!

 

 

/a07/e?CF00N40000001fxco={!Case.Account}&CF00N40000001fxco_lkid={!Case.AccountId}

 

 

Mr SlingMr Sling

Hey lksmsbg --> I found a super-simple post which broke down the important bits to note when building a custom button to pre-populate field values.  You don't have to use Visualforce to do this.

 

Check it out!  My posts and issues were solved using that tutorial and other's feedback:

 

Re: Redirecting to a different page when a custom object is created
 
Cheers!