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
Mikesfdc123Mikesfdc123 

Custom Button

For this scenario, I have a custom primary contact (look up) field.  Is there a way to create a custom button that if clicked, would automatically "create" a duplicate field - as in this case, the ability to 'add' another contact...

 

Any thoughts?

Bhawani SharmaBhawani Sharma

Do you have a visualforce page ?

Mikesfdc123Mikesfdc123

Hi!

 

I do not have a Visual Force page. In another example, I'm customizing the Opportunities Object slightly - adding a Primary Solicitation field (Label - is a Contact object look up field).  Only adding a Primary field to avoid unnecessary page clutter.  However, there are instances when there may be more than one solicitor per Opportunity.  I'm looking for a way to add a customized button, possible labeled "add" or "more" that would enable a user to add a Secondary or even a Third Solicitor if necessary - possibly an end result would be the dynamic creation of another look up field, etc.  

 

Is this possible through a customized button?  Is there a better way?  Any coding involved?

 

Thanks!

 

Mike

*werewolf**werewolf*

You can indeed do it with a custom button but it requires either a bit of Javascript (using the AJAX Toolkit) or a bit of Apex that the button calls.  So yes, there is a bit of coding involved.  That AJAX Toolkit doc probably contains some samples that will be relevant to what you're looking to do; you might also want to look in the Cookbook tab above for other examples.