Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [bestpractice]

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

2
votes
1answer
31 views

Validating Apex method parameters

Is it a good practice to validate method parameters in Apex methods? In C# and Java you generally validate against nulls and throw argument exceptions to prevent usage errors. I don't seem to see that ...
2
votes
2answers
178 views

Hosting images in SFMC - is it a good idea?

In my company, we store all the images we use in our emails in a separate FTP server; an FTP we know that can handle the load. But since SFMC has the functionality of hosting images itself; that ...
0
votes
0answers
19 views

Dynamic client side Search for Accounts in VF page

I need to make a search input - which every character that printed on the keyboard will show the closest result. for example : If I printed "uni" all accounts that they names starting with "uni" ...
3
votes
1answer
69 views

Combining similar code with different objects

I have 4 very similar code blocks in a trigger that deal with synchronizing record type changes from Opportunity to its children. The only difference between them is that they do work on different ...
2
votes
1answer
53 views

Best way to save a API integration password

I am building an integration between Salesforce and other application with REST API calls. The Salesforce will be consuming data from that other app on in interval. I am writing my code and it is ...
3
votes
2answers
156 views

What is the best practice to store custom configuration for a managed package application?

We are working on an application in managed package, and we need to store app configuration. Generally, we want to allow users to turn on/off some features in our app. For example, on the settings ...
0
votes
0answers
23 views

CTI and Record Lock

I have an issue where records are being locked while my reps are using them. The basic steps are like this: Navigate to Opportunity Contact information is pulled via an Action Layout Editor Rep ...
0
votes
2answers
59 views

Email Marketing: sending ID in email

This is a 'best practice' question: Should we be sending a Salesforce GUID in an email? We have a button in an email to ask them for consent (to a thing). That button links to a VF Page or a ...
3
votes
1answer
59 views

False matches in a SQL query activity

I am trying to automate updates to the All Subscribers list whenever the preferred e-mail in Salesforce changes. I created a SQL query activity that compares our Salesforce data extension to the e-...
2
votes
1answer
51 views

Workflow or Process Builder?

I'm creating a scenario where upon a Queue change: The resolution (text area) is updated with "XYZ text" The Staff member (ticket owner) is changed to "XYZ user" Those are technically 2 field ...
0
votes
0answers
26 views

Version control for Salesforce CPQ

Does anyone know what the most technically feasible approach is currently for managing Salesforce CPQ configuration in a version control system (e.g., Git)? We currently have most of our metadata ...
1
vote
2answers
84 views

A/B Testing in Marketing Cloud - what does the “Remainder” get sent?

When doing A/B testing in Marketing Cloud, the options here are to send a certain percentage to Email A, a certain percentage to Email B, then the "Remainder". My question is "what exactly does the ...
9
votes
3answers
487 views

Lightning Framework vs Standard Client Side Frameworks (i.e. React) // Which to chose when, and why?

Disclaimer Keep it objective! This one can get a little opinionated, please try to keep your answer specific to the facts a developer should be considering when choosing between two viable options ...
0
votes
0answers
20 views

How to handle Group emails as contact records

Good afternoon SFDC Exchange, Sorry to bother you, and ask such basic questions but would love to know your solutions on how to handle group “emails” as contact records. For example I have my own ...
0
votes
0answers
25 views

Restricting Access to All Subscribers

For compliance reasons, we need to restrict our user's access to All Subscribers but still allow them the ability to look up activity and engagement information for specific contacts. We use the multi ...
2
votes
2answers
83 views

Test a schedulable class with callout by directly invoking `execute`

I have a Schedulable class. My execute method has a future callout in it, and running it by using System.schedule doesn't run that callout: Test.startTest(); MySchedulableClass msc = new ...
1
vote
1answer
57 views

Reply to two addresses?

I've been asked to research solutions to a scenario where when a subscriber replies to an email it goes to the sender an additional 3rd party, without the subscriber having to "reply-all". My plan to ...
1
vote
2answers
61 views

How to properly decouple database layer from service layer in Apex?

I came to Salesforce from the world of Java and have been working with Apex and Salesforce for a year now. I am constantly trying to implement Java (and OOP in general) programming practices in my ...
0
votes
1answer
54 views

Mass Update Records - AWS S3

Currently, I utilize an AWS endpoint that returns a small JSON response based on my request. I am considering updating all of my records (300,000+) daily. My AWS counterparts can generate a JSON ...
0
votes
0answers
22 views

Data Designer: Add Links to Email Data Object?

I have a co-worker that wants to link a data extension with an email address field in it to our system-provided Email Data attribute group in Data Designer. I don't think that linking Keys will behave ...
0
votes
2answers
183 views

Best Practice to schedule a Batch

I am looking to find a best practice/framework to implement a schedulable batch. I don't know if create an Apex Class that implements Schedulable and Batchable interfaces is the correct way or create ...
8
votes
2answers
424 views

@testSetup vs DataFactory?

When testing, how/when will @TestSetup annotation be preferable to a "DataFactory"? I understand how both works, but I don't see any case where I'd rather use the @testSetup annotation. I use this ...
2
votes
2answers
57 views

What kinds of locks are used on Data Extensions and Sending?

Can someone explain how Marketing Cloud locks data in Data Extensions during certain routine operations? Case A: An email begins sending and midway through, a SQL Query gets ran which overwrites the ...
2
votes
0answers
27 views

Apex sharing insert

We are now investigating some performance issues for the client and trying to speed up their processes. One of the time consuming parts is apex sharing that we have there. I am pretty sure that some ...
2
votes
2answers
190 views

What is the best approach to organize utility/helper methods in controller?

I have several controllers. In each controller class I defined the same set of helper methods: private void info(String msg) { ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, ...
2
votes
1answer
35 views

Where should validation of Id be placed?

BACKGROUND I have the following visualforce page (this is just for the completeness of the example) and custom controller: Visualforce page: <apex:page id="documentStatusPage" controller="...
4
votes
4answers
628 views

Is it okay to create Test records on the Production?

Okay, we have a major release coming next week. So, I would like to know if this a good/best practice: After the successful deployment using Change sets, some other manual deploying steps(sObject's ...
1
vote
2answers
173 views

How to Lock/Restrict/Block record from change in Salesforce Lightning

BACKGROUND I am updating an external accounting system with information from custom objects like Invoice Credit Note Payment Transaction The Invoice and Credit Note custom objects have Status ...
1
vote
0answers
18 views

Include a data file in a document

I am including a data file (JSON) and am reading the values ​​of it in Apex. Is this a good practice? Since my data will not change and the settings are too large to be saved in a metadata. The file ...
2
votes
2answers
243 views

Custom Labels - naming conventions - best practices?

We're about to start refactoring a bunch of hard-coded text from a client's Lightning Components and Visualforce pages into Custom Labels so that they can support multi-language users. Unfortunately ...
0
votes
1answer
39 views

Cyclic Dependecy between objects

We have a custom object - ExternalPortal Users which is a child of Opportunity and Contact. Contact Path: There is a checkbox on Contact - IsExternalPortalUser. If checked creates ExternalPortal ...
3
votes
3answers
1k views

Lightning Component Best Practices

Inspired from this question General trigger bulkification - best practices I wanted to ask what are the best practices when it comes to lightning components development?
-1
votes
1answer
315 views

(Why?) Is it good for Apex methods to be static? [closed]

Many native objects in Apex rely on static methods and properties. This seems an abnegation of S.O.L.I.D., or at least of the Dependency inversion principle. As a developer who values the test ...
2
votes
2answers
145 views

(Why?) Is it good for Apex classes and methods to be final? [closed]

By default, in Apex, unlike Java and other OOP languages, all classes and methods are final. You aren't allowed to make this explicit and if you want things not to be final, you need to use the ...
9
votes
2answers
701 views

How to Reduce Repeated If/Else Logic in Code

I'm relatively new to Apex, and one thing I've found is there are a few places in my code where the same the same if/else logic is repeated. I.e. if (first_condition) { // do something } else if (...
3
votes
1answer
45 views

Best approach to translating numerous email templates

The Problem: I have approximately 30 different email templates that are being sent out to applicants during an application process. Applicants have 3 language options: English, French & Portuguese....
4
votes
1answer
62 views

What is too many functions?

While reading through on some lightning documentation I came across this piece regarding Anti-Patterns. I have definitely had some helpers which have run the risk of embodying that anti pattern. How ...
0
votes
0answers
23 views

French SMS considerations

We will start sending SMS to France and we have found some restrictions in other providers such as Nexmo: https://help.nexmo.com/hc/en-us/articles/204017483-France-Features-Restrictions Does anyone ...
0
votes
1answer
23 views

Any Flaw in using below logic to avoid multiple time execution of a functionality in Trigger code?

I have a Trigger on an object, which is calling a method of other class(passing Trigger.New so that some functionality is executing depending on values of passed record) which should be called after ...
0
votes
1answer
35 views

Is it best practice to update an object based on Two objects?

I had to populate other objects data with an object ELE Agreements. I am not sure my code is best practice or not because I am using two Objects queries. I am afraid of any SOQL Limitation error ...
0
votes
1answer
275 views

How to mark a Salesforce Contract record as canceled or terminated?

I understand once a contract has been Activated, the status cannot be changed. However, there are times when a contract is terminated (ends early) and there needs to be a way to indicate this. Are ...
1
vote
1answer
102 views

Is that possible to enqueue more than one action? Please suggest

I just read the best practices article for the Lightning and I am wondering is that possible to have more than one enqueueaction in client controller js? Please suggest. There is some hint given in ...
1
vote
1answer
487 views

Trigger Best Practices - Multiple classes or single class?

I know a trigger best practice would not include logic within the trigger itself and this should be put in a separate class which is fine. However, if you have multiple operations being performed by ...
0
votes
1answer
64 views

Best Practices Regarding Formatted Data in Data Extensions

We're currently setting up a new data extension for our orders, and the previous data extension was importing every column as TEXT. This means that every query we run must first CAST or CONVERT these ...
1
vote
1answer
380 views

How to check field accessiblity of a field that is related to the object being checked

While developing secure controller actions for a Lightning Component, I ran across an issue checking accessibility for an Account level attribute related a Contact. For example: Schema.SObjectType....
0
votes
0answers
14 views

Safe to create custom object log records in a security-reviewed managed package app?

I want to create a logging system for our AppExchange managed package that will be recorded by Usage Metric features and will also comply with security guidelines to pass the review. To achieve ...
1
vote
2answers
62 views

Conditional logic or throwing an exception when checking FLS and object CRUD?

When checking Field-Level Security or object CRUD in Apex within a managed package, is it required to use conditional access to prevent the given operation (for the purposes of passing the security ...
4
votes
2answers
127 views

When (if ever) will testmethod fail to compile?

I just recently learned from the Apex Developer Guide documentation on the IsTest Annotation: The testMethod keyword is now deprecated. Use the @isTest annotation on classes and methods instead. ...
2
votes
1answer
90 views

Avoiding nested for Loops - finding sibling records

Background: I have a Children object that is child of Opportunity. When a Children record gets inserted/updated i want to find if there any other sibling(children) that is set as primary children if ...
5
votes
1answer
136 views

What value is there in an Application Service Provider

As I implement Andrew Fawcett's, Apex Common library referring to the fflib-apex-common-samplecode when necessary, I note that his ObjectService classes (i.e. OpportunitiesService.cls) are really more ...