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

APEX Trigger or Custom Button?

Hi guys!


I need some advice on wether I should be learning / writing an APEX trigger, or wether a custom button would be better for my application.


I have the 'Cases' Related List in my Opportunities Section. My Cases object has 3x Record Types (New Warranty Service, New Installation Service & New Maintenance Service)


Under My Opportunity, I want to have the three buttons on the cases related list (New Warranty Service, New Installation Service & New Maintenance Service). Once they are clicked, I need different information from the opportunity to populate each different record type.


Am I best to use a custom button and 'URL HACK' it to populate these field, or should I look into writing an APEX tigger to 'future proof' my SFDC instance? I have been told that the 'URL HACK' is really just a temporary fix if SFDC decide to update field names etc, they will break.


Thanks in advance for the help!




hi Jimmy,


our first option for a solution should be based on speed of implementation, complexity and how  easy is to maintain that solution therefore, in,  that  means we should try first a solution that requires only poin-and-click  changes - no apex/visualforce development.


Your requirement can be fulfilled with 3 list buttons that pre-select the recordtype and other fields from the Opportunity. I believe this is what you are suggesting but you doubt about the support of sfdc on this. I can tell you that we have this in many areas in our org and for a long time, never had a problem with a sfdc release.







Fieldnames wont change frequently so you should use URL HACK and you can save lots of time which can be use for updating it later on if fieldname changes ;)