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
JohnPCutlerJohnPCutler 

Best Practice -- S-Control vs. Apex Trigger

I have a best practices question. Before I go too far down one particular road, I was hoping to get some feedback from those with more experience.

The Requirement
We are a non-profit dealing with complex cases involving many players. Therefore, it is highly likely that the person calling (or emailing) the advocate will NOT be listed as the primary contact on the Case. For example, in some cases, you might have a social worker, caretaker, client, and/or family member call with information and questions. We intend to use the Case Roles related list for Cases, but this has the disadvantage of only being accessible via reports. It can't show up as a related list in related objects.

Ideally, we'd have a "Case Relationships" object that could appear as a related list on Accounts / Person Accounts / and Contacts. This would allow the advocate to field a call, locate the contact, and from the related list find the case.

I have tried two approaches thus far ...

S-Control
Create an S-Control that simulates a related list. The S-Control queries Case Contact Roles, and displays all the records with a matching account / contact Id. This works well, but has some major drawbacks. First, it doesn't appear with other related lists. Second, it has none of the functionality enjoyed by related lists, and I am hesitant to make a bulky S-Control.

Apex Trigger and Custom Object
Writing the Apex code for the trigger was pretty easy, even for a beginner. I basically created a new Case Roles object with Account, Contact, and Case lookup fields, as well as Case Subject and Role fields. I automatically populate the account field before  update. I wrote another trigger on the case object to sync the Case subject with a custom field on the Case Roles object after update. On Case delete, all the child Case Roles were also deleted.

Case_Roles__c
-- Account (always set to Contact's account)
-- Subject (always set to Case's subject. On case update, all child Case_Roles are updated)
-- Case
-- Contact
-- Role
-- Role Notes

This had the major advantage of acting like a related list, and having all the normal functionality of a custom object. That said, I am inexperienced, this will require an upgrade to Unlimited (I wonder if SF will allow this since the licenses were donated), and deploying triggers seems pretty complicated. Basically, even though I was able to accomplish this in my Developer edition, I wonder if Apex is over my head.

Any thoughts? Sorry for the long post. I guess this all stems from a non-standard requirement, but I am interested to see how other people might approach this.

Thanks

John



adamgadamg
I'd ask some of the folks about the availability of Apex Code for non-profits before proceeding down that route; that said, Apex is likely the prefered way to go
JohnPCutlerJohnPCutler
Thanks for the feedback Adam. The Apex Code stuff is really slick. Even as a newbie programmer, I can fully understand the value. Plus, I have seen some horrific S-Controls that were doing a lot of heavy lifting outside the UI level. Hopefully, we can work something out with SF.

The element that actually seems the most daunting for me is deployment. The docs aren't completely clear. Can you deploy from a sandbox organization without using Ant? I guess I need to bite the bullet and download eclipse and Ant and learn this stuff. It is too cool not to use and learn!

John
Ron HessRon Hess
Can you deploy from a sandbox organization without using Ant?

yes, there is a wizard in Eclipse, right click on your project, pick Apex -> Deploy to Salesforce.

you can pick one or more classes to deploy  
JohnPCutlerJohnPCutler
Does this apply to classes and triggers? I am coming at this from a complete newbie's perspective. Triggers seem much more within my realm, and easier to grasp, and I was hoping to be able to deploy triggers without using Eclipse, or Ant, right from the web ui. Is this supported in Unlimited edition?
Ron HessRon Hess
Yes, you must deploy classes and / or triggers before they will appear in your production org.
The deploy process applies to both.
Deploy is performed by using Ant or Eclipse (or directly using the API service for deployment, if you write your own deployment app.)

there is no deploy feature directly from the web UI.
JohnPCutlerJohnPCutler
Perfect. Thanks Ron for the clarification.
AkiTAkiT
The "Deploy to Server" in Force.com IDE in eclipse is pretty straightforward and easy to use for deploying to production. It tells you also the test coverages, and doesn't let you deploy if coverage goals are not met.