The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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.

Filter by
Sorted by
Tagged with
3
votes
3answers
129 views

Batch - Sending data from one batch to another

I having a little issue to understand the concept of passing params via batches. I have two batches which I would like to send data between them. Batch A creates a Map<sObject,Set<String>&...
0
votes
1answer
781 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
45 views

LWC & Aura Coding Standards

I want to ask if somewhere I can find best practices how to develop in LWC and Aura? Salesforce has prepare that kind of document for Apex: https://developer.salesforce.com/page/...
0
votes
1answer
22 views

Identifying Inactive Contacts

My question is not about how to deal with inactive contacts, but it is about how to identify inactive contacts. Our Org has 300k Contacts, about 50% of these are obsolete. I have created a check ...
64
votes
6answers
17k views

What is a good set of naming conventions to use when developing on the Force.com platform?

I've looked in the Apex developer's guide and a saw the Naming Conventions section which has basically only has this: We recommend following Java standards for naming, that is, classes start with a ...
34
votes
6answers
5k views

What is a good set of coding conventions for Salesforce development?

I've looked around in the Apex and Visualforce developer guides and around the web and can't seem to find any coding conventions out there. The Apex Dev guide has a section on Naming Conventions that ...
1
vote
2answers
657 views

Naming convention [duplicate]

What is the best naming convention developers around have been using for defining Record names to maintain uniqueness that can also be searched easily : foreg: opportunity name : Opportunity ...
0
votes
0answers
17 views

Best practice for controlling record access based on User's Country

The requirement: All Users in South Africa should only be able to edit Accounts (parent) where Country = "South Africa". They should also be able to edit all Projects (child) and Project Roles (...
12
votes
2answers
936 views

Performance Impact of DescribeSObjects vs. Individual Describe Calls?

I've been wondering this for a while, so it's time to put this question out there. How does Schema.describeSObjects perform when compared to individual calls to SObjectType.getDescribe? For example, ...
32
votes
1answer
2k views

Does an Apex or VisualForce code style guide exist?

Has anyone written an Apex or VisualForce code style guide, in the way of the Ruby Style Guide or jslint, or PEP-8, or any number of Java guides? I'm in the process on creating one for internal use ...
0
votes
1answer
39 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" ...
31
votes
8answers
9k views

Use of @IsTest versus testMethod and location of test methods in classes

Is there any advantage to using the older testMethod keyword to identify test methods or is it better to use the @IsTest annotation? Does the location of these test methods have any significance? E.g....
1
vote
2answers
50 views

Best Practice: dependency on data model names [closed]

BACKGROUND I need to display some data from another system on a lightning component. Let's say I get a JSON string from the external system as following: { "initialStatus": "Active", "name": "...
5
votes
2answers
211 views

lwc dataservice architecture best practices

While developing lwc components and lightning apps I always run into this design dilemma: When I have two children components that uses the same set of source data but in different forms what is the ...
14
votes
4answers
2k 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 ...
4
votes
1answer
55 views

Whitelisting Salesforce IP In External Systems

I want to integrate with an external system. They need to whitelist my IP for permission to use their services. I looked at this post: https://help.salesforce.com/articleView?id=000321501&type=1&...
3
votes
0answers
32 views

Is usage of console.log/console.error in production code considered as bad/good practice?

Well I've seen a lot of code examples provided by Salesforce. In one blog post - Error Handling Best Practices for Lightning and Apex - they are using console.error to report errors on ui. They also ...
2
votes
2answers
66 views

with and without sharing with innerclass

I'm working on a project that needs to change a lot of data that the user shouldn't see in the backoffice. So I'm wondering if I should put my entire class "without sharing". For now I'm creating a "...
5
votes
1answer
366 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 ...
1
vote
1answer
48 views

Best practice for a query inside a batch and Mapping

I'm working on a batch which getting a params from another batch in the finish method. The Params are : A Map - Map<Sobject,Set<String>> A Set - Set<String> I lost the values of ...
9
votes
3answers
6k views

What controls the 'severity' of ApexPages.addMessages(exception)?

I'm trying to crystallize out some 'best practises' for Visualforce Page exception handling. I think, at a minimum, a page should look something like this: <apex:page controller="PageController"&...
7
votes
1answer
2k views

SOQL: prevent SOQL injection - best practices

I have a query string that is as follows(no bulkification required)... String qryString = 'SELECT Id FROM Contact WHERE (IsDeleted = false and Name like \'%' + searchText+ '%\')'; searchText is a ...
2
votes
1answer
31 views

Get component value directly

This is a general question aimed at finding best approach to do some task. Now I interested in how should I get values from inputs in lightning components. Let's say I have a component: Example.cmp &...
3
votes
1answer
79 views

How should I schedule multiple job of the same class?

I need to have a job that runs every 15 minutes. I checked out the documentation for Apex Scheduler and I came up with two solutions: 1-st: ScheduledJob job = new ScheduledJob(); System.schedule('...
0
votes
1answer
103 views

Best approach for handling preventing Parent trigger when updated from multiple child objects

I need some suggestions in improving the 'prevent trigger' logic. I have parent 'Lead' object and couple of child objects. I have Trigger Helpers on each of these objects. When these child object ...
1
vote
0answers
29 views

Bulk Job Status - Failed vs Not Processed?

What are the use cases for setting a Bulk (version 1) job to a status of Failed vs Not Processed? Salesforce documentation gives the same description for both The batch failed to process the full ...
8
votes
1answer
197 views

Most efficient way to switch on SObjectType?

It is a bit odd we can't evaluate a switch statement directly on SObjectType, so I am trying to determine conclusively which workaround is the most efficient. Just to verify, I tried to compile this ...
2
votes
1answer
65 views

Enterprise Patterns for Consuming non-trivial REST services in Apex [closed]

Communication from Apex with huge REST Apis feels cumbersome to me as there is so much repetitive work involved with building Apex Objects that function as callout request params or responses. This ...
0
votes
0answers
33 views

best practice to find the duplicate contact using apex trigger (not using duplicate rules)

I am using the below handler class in contact trigger to find the duplicate contacts, it checks only the lastName now if I want to check more than 2 or 3 filed then the only option I have is to create ...
1
vote
2answers
98 views

Using String Object or Field Names instead of literals. Using object prefixes

Is there any benefit of getting sobject type using Schema.getGlobalDescribe().get('Lead'); instead of Lead.sObjectType; Also what is the benefit of using 3 char prefixes of known IDs like Id ...
1
vote
0answers
33 views

Validate inputs on server side

BACKGROUND I am working on a lightning component which is a simple form that takes from, to emails and a message body as user input and passes this data to an apex controller. Apex Controller ...
1
vote
1answer
115 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 ...
31
votes
0answers
731 views

Best practices for designing and maintaining Global classes?

We've always been conservative when it comes to exposing Globals for use by extension packages or subscriber extensions, and perhaps too conservative. We're considering being more proactive wth our ...
3
votes
3answers
92 views

Array notation for List<List<Sobject>>

In an attempt to be as byte pinching as possible(personal goal), I have a question some time on Google has not been able to answer. I did look at some Java documentation to try and resolve the issue ...
2
votes
1answer
52 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 ...
4
votes
6answers
16k views

Is it advisable to call Batch from trigger

I was thinking of calling a batch class from my trigger. Is is advisable to do that? As batch will have asynchronous execution with respect to trigger.
2
votes
2answers
433 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 ...
3
votes
1answer
74 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
96 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
312 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
26 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 ...
31
votes
2answers
12k views

Post Sandbox Refresh Steps

What steps should be taken after a sandbox refresh to avoid filling up the sandbox storage, sending emails, or outbound messages? I'm looking for steps to take such as disable scheduled Apex jobs, ...
0
votes
2answers
66 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
63 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
60 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
49 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 ...
4
votes
4answers
737 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
247 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 ...
1
vote
1answer
249 views

What is clearReference(“v.attribute”) used for?

Did anyone ever use cmp.clearReference("v.attribute")? The documentation says it should be called before resetting attributes with component.set(), what sounds kind of useless to me. There are no use ...
0
votes
0answers
21 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 ...