Referring to the use of recognized community and platform best practices. May relate to all areas of lifecycle and all development and administration activities.

learn more… | top users | synonyms

4
votes
1answer
58 views

Bulk data API: How to Avoid Upserts

I'm working on an daily integration of about 5 million records (file delta's is not an option). Best practices for large data volumes recommends avoiding upserts. The only alternative solution I can ...
4
votes
2answers
122 views

Apex trigger - is this the best approach?

I'm getting up to speed with Apex - I have written a trigger that works, but is this the approach that an experienced coder would take? I have a custom object (vist_detail__c) which has a lookup to ...
1
vote
1answer
37 views

Retrieving & Updating record related by Junction Object with single SOQL query

I've written the below Trigger to update Opportunities with a date value from MPM4_BASE__Milestone1_Project__crecords. The two objects have a many to many relationship and are related by ...
0
votes
1answer
29 views

Exacttarget - Sending email to filters VS sending email to filtered data extension

I would like to send emails to a group of subscribers. I would like to filter them from the data extension subscriver_all, where all my subscribers are. From what I know there are two ways of doing ...
8
votes
4answers
158 views

Archiving Data to Heroku

Ok after hours of searching I cannot believe that something that would seem like an every day need does not have any videos, tutorials, etc directly related to it. Heroku is tough for me as it seems ...
3
votes
1answer
36 views

Javascript Remoting vs Consuming Web Service

I am accessing a service side function through a javascript button on a visualforce page and I wanted to know; what is a better solution - Javascript Remoting or the AJAX toolkit (consuming a web ...
2
votes
2answers
34 views

How to limit control flow during unit test?

I want to limit the control flow during a unit test so that it does not leave the method being tested. The unit test is for a controller method, and in that method the controller creates an object and ...
2
votes
3answers
94 views

How to test apex code that is driven by formula fields (Best Practice)?

Question Are there any best practices out there for testing apex code that is driven by formula fields so that changes to the formula field formula don't break your test? Background Good test ...
1
vote
1answer
25 views

How to deal with Activities in a Case Hierarchy?

Let's consider a Case in the service sense of the word - a caller calls up with a situation ("My printer's broken."). Now, maybe the caller calls up about more than one situation ("My printer's ...
6
votes
1answer
182 views

Salesforce - business logic - best practices

I would be really grateful if anybody could help me clarify, where to deploy business logic. I'm aware of the following possibilities: Write the main parts of the business logic in Apex Apex ...
-1
votes
1answer
87 views

How to Write a Test Class for Webservice Class?

Situation I wrote a web service class. From my understanding unit tests in salesforce are supposed to test the whole functionality (end to end). But I don't know how to test this external interface. ...
5
votes
1answer
87 views

Test Classes to Cover Multiple Triggers/Classes, or 1-to-1?

Background: My org has reached almost 750 unique un-managed classes and triggers. Until now, we had been adhering to the 1:1 test class to class school of thought. Now, we are at the point where we ...
5
votes
3answers
102 views

Should member variables be initialized inline or in the constructor?

Is there or should there be a hard and fast rule for whether to initialize a class's member variables inline vs. inside a constructor? Consider the following two approaches that I think are ...
6
votes
1answer
108 views

Considerations for calling out to enterprise applications behind a firewall from salesforce?

If I'm looking to integrate an enterprise application behind a firewall with Salesforce, what considerations should I be making? From the architect certification study guide Given a scenario, ...
2
votes
0answers
30 views

Get Chatter Group Link with URLFOR

Would like to add a link to a chatter group to a visualforce page. Following best practices was trying to use {!URLFOR()} so the page doesn't break if the chatter group url format changes. However, I ...
5
votes
2answers
123 views

Is there a more efficient way of getting an object by related list?

I've started programming in Salesforce in January 2015. Most of my code uses this methodology : : List<String> accountIds = new List<String>(); for(Account account : accounts) { ...
1
vote
2answers
30 views

Using field tooltips - What's best practice? [closed]

What's the best practice for when/if to add field help text? Should every field have help text or only the fields where the field label is not self-explanatory? Note: This is a business question, ...
8
votes
4answers
2k views

Efficiency of List.size() > 0 vs. !List.isEmpty()

Anyone have any data to support a claim for which of the following two expressions is more efficient (meaning faster)? The use case is determining whether a List is empty to inform an auxiliary method ...
7
votes
4answers
389 views

One Trigger Approach: Any Logic in Trigger?

I am getting my head around really using a single trigger approach and I appreciate that minimal logic should be in the trigger. I'm already using utility classes but I'm used to including filtering ...
2
votes
2answers
196 views

Why (seealldata=true) results into more code coverage?

I wrote a trigger to prevent more than n incidents for a client(lookup to user) at any point of time. trigger CountLimit on Incident__c (after insert,after update,after undelete) { Set<Id> ...
0
votes
2answers
165 views

Fire Trigger Only When Stages Moves to Closed Won

I have the trigger class below and I would like it to fire only when an Opportunity Stage is changed to Closed Won. Can anyone help me figure out how to do this? I have an if statement, but it fires ...
0
votes
1answer
66 views

Using Product and Pricebooks without set Product Prices

I need to see best practices for our pricing model. We have a SaaS company without a set price. All of our product pricing is dependent on the size of the company that signs up. So I'm not sure how to ...
4
votes
2answers
483 views

How do I access Custom Settings in Apex?

If I have a hierarchical custom setting: Custom_Page__c With one field: Url__c Using apex, how can I surface this field in a visualforce page? Can I just query it as if I was querying a custom ...
0
votes
1answer
38 views

Enabling Enhanced Lookups

Does anyone know of any disadvantages (or compelling reasons NOT to enable) Enhanced Lookups? I don't see any references to such information in Google and Stack Exchange searches. My knee-jerk ...
1
vote
1answer
31 views

Salesforce code kata

Personally I find the repetitive execution of some simple exercise very helpful to me: a good way to learning. Even if I'm totally ok with programming (java, javascript) I'm totally new to ...
1
vote
1answer
63 views

Best practice (UAT) testdata

I was wondering what your opinions are about UAT testdata in case there's no Full Copy Sandbox available. As far as I'm aware there's two options: Developing a testdata factory, which tries to mock ...
0
votes
2answers
45 views

Dealing with legacy data violating validation rules

In a traditional database, constraints will be applied to all data in the database. In Salesforce, however, validation rules only apply to data that has changed. As I update my schema, I also update ...
2
votes
2answers
241 views

Time-dependent workflow error handling

Question: How are errors (validation rules, addError in triggers etc.) handled by time-based workflows? And are there any best practices regarding time-based workflow error handling? Example: In my ...
0
votes
1answer
453 views

Translation, Localization and Internationalization Best Practices

There are plenty of things to keep in mind when trying to allow translation, localization and internationalization (t8n, l10n, i18n) in any framework. Salesforce has a whole infrastructure built ...
7
votes
1answer
295 views

Best practices for custom controller actions

Many times I've came across the following issue: should I use one custom controller for all the actions for some sObject or some area, or maybe there should be separate controllers for editing, ...
5
votes
1answer
57 views

Is it feasible to create a “universal join” object?

In a blog addressing the implementation of Milestones PM into an existing Org, Reid Carlberg suggests the creation of a "universal join object." In essence, this object effectively facilitates type ...
2
votes
1answer
69 views

Best Practise: Data Migration

I want to run a data migration using dataloader. I have changed the structure of my database and now I need to migrate the data. I am just wondering what is generally done in terms of testing the ...
3
votes
2answers
433 views

What are the best practices for Triggers

My requirements are: Upon creation of Accounts there is a trigger that creates a contact with specific record type Organization Donor Proxy I wanted to create another trigger on Account after ...
3
votes
3answers
675 views

trigger design pattern

I was watching some videos on apex best practises and I spotted some discrepancies in advice people give. I wonder how you people code your triggers. The recommendation is to have one trigger per ...
2
votes
1answer
56 views

Can I move this JavaScript function which VisualForce used out of the global namespace?

Currently looking at Refreshing Chart Data Using JavaScript Remoting Reading about JavaScript best practices, I came across the idea of keeping functions out of the global namespace, so I tried to ...
0
votes
1answer
45 views

Multiple File Data Set Import Cleaning

It is pre-Salesforce import, I have designed the Named Account structure inside Salesforce, and I have 1500 Hoover's D&B Family Trees with the same columns and headers in .xls form. What do I use ...
9
votes
2answers
855 views

How to set up views and navigation in Lightning?

What is the best way to create views in Lighting? And then, how would you navigate from one view to another? Conceptually I'm thinking that I'll have two components, ns:foo and ns:bar, and essentially ...
4
votes
1answer
102 views

Generic account owner considerations - record skew - customer portal accounts?

In our organization, accounts aren't owned, and teams are used to manage sharing of accounts. We're planning on having all accounts owned by a single generic user. According to the architect resources ...
5
votes
7answers
1k views

Multiselect Picklists with many values

I have several fields in my org that require picklists with many values. Examples of values include countries, langauges, NAICS codes and the like. Multiselect picklists are limited to 150 choices, ...
4
votes
1answer
66 views

Best practices for naming unit tests [duplicate]

My organization has a mishmash of apex classes, both regular classes that execute specific business logic and test classes that execute unit tests on those regular classes. When we started developing ...
0
votes
2answers
46 views

Which code is heavy when being executed

I'm comparing records based on their dates, if the date is equal to a particular month its data goes to a particular object. Example: If this the record is in the current month then it will be saved ...
2
votes
0answers
65 views

How to hide components until data are bound in Lightning?

What is the best way to configure components or elements to be hidden until the required data binding operations have been completed in the background via Ajax? I'd like to replicate the current ...
1
vote
1answer
249 views

Why does my delete trigger cause a 'Too Many SOQL Queries' error?

I have a trigger that is supposed to see if a field is empty and, if it is empty, it is supposed to check if there is an Account Team Member with a certain role. If that is true then it is supposed to ...
1
vote
0answers
165 views

Best way to set up dependent picklists in Lightning

One common programming challenge I anticipate in Lightning is the need to set up dependent picklists. I've cobbled together one approach shown in this gist for setting up a dependent picklist, but I ...
4
votes
1answer
431 views

How to pass values across Lightning components?

What is the best way to pass, propagate or share values across Lightning components? For example, let's say I have two components ns:foo and ns:bar. Both components have the following attribute: ...
1
vote
2answers
49 views

Should all available metadata be managed in a VCS?

I'm setting up a git repository for an SFDC project across a team of developers. I think I should commit all metadata comprising the full org so we can manage changes in addition to the usual ...
2
votes
2answers
336 views

How do I test an apex trigger that sends an email

Trigger is: trigger emailtemplate on opportunity(after update) { List<opportunity> oList = Trigger.new; List<opportunity> nList = trigger.old; ...
1
vote
1answer
152 views

Change Contact Owner for Profile

I have a case in which a certain user with profile that should be able to transfer a contact even the contact is still not his own. I tried using the 'Transfer Record' in both the profile and ...
3
votes
1answer
117 views

Best Practices for Validate field in Salesforce

This is my scenario: - Object Name: Contact . - Field: -Status__c (Picklist) contains: Active ,Inactive or NULL -StatusDetail__c (Text) The requirement is whenever Status not null , we ...
5
votes
1answer
274 views

What is the Best Practice for the right Training Environment?

As we all know, good user trainings are crucial to ensure a high adoption rate and a successful CRM strategy. I'm hired quite regularly by customers to provide enduser trainings. Always there is the ...