All Questions
132,701
questions
166
votes
4
answers
64k
views
What are Salesforce ID's composed of?
I remember seeing somewhere that IDs are composed of a few pieces. I always have a hard time trying to find that information when I'm looking for it. What I mean by the above is that the various ...
158
votes
8
answers
37k
views
Unit testing code which has logic around the CreatedDate
An example of the problem would be trying to test a trigger on a case which will fire on update, and look for time differences between when a case was created and now. Ideally in the unit tests I want ...
157
votes
3
answers
26k
views
End of javascript sidebar workarounds? (Salesforce Classic / Aloha)
Reading through this doc:
Docs.releasenotes.salesforce
We replaced the rich text editor in HTML Area home page components
with a new version that supports more markup but doesn’t allow HTML to
...
138
votes
2
answers
11k
views
Any reason to skip DML on empty lists?
In parts of my code I have DML statements with an if around to only do the DML if the list is not empty:
if( !recordsToUpdate.isEmpty() ) {
update recordsToUpdate;
}
Couldn't I just write?
...
133
votes
3
answers
9k
views
Force.com IDE - Still Officially Supported?
In the Summer '13 release webinar, Ryan Upton and Samantha Ready mention that the Force.com IDE is no longer being supported. During the Q&A time, they both chime in on a question related to the ...
127
votes
2
answers
26k
views
How to reduce a large internal view state / what is in the internal view state?
I'm building an account search page that lets users select accounts and then pass them to other pages to perform various actions on them. Unfortunately users are reporting hitting the view state ...
125
votes
2
answers
152k
views
Is it possible to run a SOQL Query and get a Map returned?
It is possible to run query and the results inserted into an Apex list:
List<Opportunity> opportunities = [SELECT Opportunity.OwnerId,
Opportunity....
124
votes
3
answers
122k
views
How can I efficiently generate a Set<Id> from a List<SObject> structure?
I have a bit of code where I've written a SOQL query that returns a list of SObject records, however I need a Set<Id> structure to pass to another method that I don't have control of (and thus ...
117
votes
1
answer
18k
views
Difference between the multiple messaging options in Visualforce?
I have always been curious what are the exact differences between all of the messaging options Visualforce provides, such as apex:message, apex:messages, apex:pageMessage, and apex:pageMessages. The ...
115
votes
13
answers
54k
views
Can we determine if the Salesforce instance is production org or a Sandbox org?
I am looking for the most efficient way of identifying the type of org (Production or Sandbox) via Apex code. URL scraping is not useful to me, since I'd like to get this information inside a trigger ...
109
votes
11
answers
41k
views
How do I start to debug my own Apex code?
Sometimes questions are posted here that would best be answered by helping the questioner learn how to do their own debugging. (Remember that proverb?) I'd like to have something to link to on this ...
102
votes
1
answer
4k
views
When are the Queueable/Batchable penalties going to be enforced?
According to The New Apex Queueable Interface, from October 2014, we were told that chained Queueable calls would be exponentially delayed up to 64 seconds, chaining Batches would be exponentially ...
88
votes
7
answers
15k
views
Apex static code analysis
What static code analysis tools are there for apex? The only one I seem to be able to find is the Force.com Security Source Code Scanner but that has the draw back of placing your request into a queue ...
86
votes
4
answers
53k
views
SFDC: Understanding With Sharing, Without Sharing & Unspecified Sharing Classes
Per my understanding of With Sharing, Without Sharing and non-sharing-specified Classes in Apex, I would like to jot down the following notes and leave certain blanks for not sure answers; I wanted to ...
85
votes
7
answers
16k
views
How to study/prepare for the Salesforce ADVANCED Developer Certification?
After reading the overwhelming responses to the question How to study/prepare for the Salesforce Developer Certification, I decided to ask the same question but for the Advanced Developer ...
84
votes
2
answers
15k
views
Salesforce, Oracle and the Seven Dwarfs
Over my time as a Salesforce developer, I've written some code which on occasion managed to surface Oracle plsql exceptions and curiously the error text contains the name of one of Disney's Seven ...
82
votes
5
answers
12k
views
Pokemon Catch - Generic Exception Handling In Apex
I read a great post about this topic on Stack Overflow: Is it really that bad to catch a general exception?
However, I asked this question on our exchange because I am interested in a more specific ...
81
votes
2
answers
17k
views
Has anyone, ever, successfully invoked the Metadata API from within Apex?
While researching a semi-related question posted here earlier, I dug up some interesting and conflicting information regarding whether it's even possible to use the Metadata API from within Apex. I ...
81
votes
3
answers
14k
views
How does SF calculate the CPU time?
How does SalesForce calculate the CPU Time that was introduced in Winter '14? I am seeing varying results from it. Why does the CPU count vary?
I am running a single block of code over and over again ...
77
votes
11
answers
75k
views
How to study/prepare for the Salesforce Developer Certification
I am fairly new to Force.com development (less than a year). I did not learn it from the ground up. So I think it will be good to study for the developer exam to strengthen my basics and improve my ...
76
votes
3
answers
37k
views
What is the difference between Custom Settings and Custom Metadata Types
Summer '15 is going to include the GA release of Custom Metadata Types. See Introducing custom metadata types: the app configuration engine for Force.com
Are Custom Metadata Types intended as a ...
74
votes
1
answer
6k
views
InstallHandler runs under a special ghost user. What rights does it have?
When you install a managed package with a post-install script, Salesforce creates a special ghost user under which all of the post install activities occur. I think this is undocumented. Here are some ...
73
votes
4
answers
28k
views
Elegant way to convert Set<Id> into String for Dynamic SOQL IN comparison
When I have a Set of Id's and I want to do a dynamic SOQL query that I want to use it in for an IN comparison, I have to convert the Set to string in the format of:
('id1','id2',id3',...)
The way I ...
72
votes
6
answers
25k
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 ...
71
votes
8
answers
65k
views
Get lists of dependent picklist options in Apex
I have a pair of dependent picklists. In Apex code, how can I determine what options are valid in the dependent field for each option in the controlling field?
I've tried using getPicklistValues(), ...
70
votes
2
answers
38k
views
Connected App - avoiding a limit on a number of issued tokens + token expiration
We have configured our web application to use OAuth2 with our SFDC Connected App. The connected app is configured to never expire the refresh token unless manually revoked. When an admin connects the ...
69
votes
8
answers
76k
views
What is the best way to deploy profiles in Salesforce? (especially system admin)
What is the best way to deploy profiles in Salesforce?
I have a system admin profile with access given to the objects that i have created in my sandbox. I have about 1000 fields across these objects. ...
68
votes
5
answers
35k
views
How do you deserialize json properties that are reserved words in Apex?
Is there any way to deserialize JSON into an object using JSON.deserialize if some of the property names in the JSON are reserved words in Apex? I want to do something like this:
string jsonString = '{...
64
votes
1
answer
24k
views
Is there a way to do Like against a list of Values?
Is there a way to mix LIKE operator with IN ?
Something Like
SELECT Id FROM Account WHERE Name LIKE IN:nameList
Where nameList is list of String?
Is this is possible ?
(I can make a dynamic query by ...
64
votes
4
answers
29k
views
Call Apex class method on the fly (dynamically)
Is there any way I can call apex method from class if both class name and method are stored in the string.
String strClass = 'BatchUtil';
String strMethod = 'updateAccounts'
now I want to call above ...
64
votes
1
answer
60k
views
Setting a from address in SingleEmailMessage
I want to set a from address in a salesforce SingleEmailMessage, but can't see a way to do this and there is no standard method described in the documentation.
I want the email to be sent from ...
63
votes
8
answers
74k
views
Removing old hub org, or non-scratch org from Salesforce DX org list
In the Salesforce DX pilot, every pilot participant was given a temporary dev hub org. These orgs expired, were destroyed, and sent back to the matrix in advance of the open beta.
I had an existing ...
62
votes
10
answers
85k
views
What would be the best approach to get the recordtype id
I know of two approaches to get the recordtype id of a particular record type
Use SOQL
RecordType RecType = [Select Id From RecordType Where SobjectType = 'Account' and DeveloperName = 'Business'];...
61
votes
6
answers
93k
views
How to run a scheduled job every 15 minutes?
Using the salesforce GUI it seams impossible to schedule a job every 15 minutes. Or more than once a day.
60
votes
3
answers
26k
views
What's the practical difference between canvas & connected apps?
Question
What's the point of canvas vs. connected apps, and what should I be thinking about when choosing between them?
Background
We're in the process of building out a couple tools that will be ...
60
votes
3
answers
22k
views
What is the difference between Aura and Lightning frameworks?
Apart from Wave, the biggest announcement from a developer perspective at Dreamforce 2014 is "Lightning" and it will be announced in the big keynote by Marc Benioff today. I've started to play around ...
60
votes
3
answers
30k
views
Lead Conversion Trigger Order of Execution
I've got a project where I'm looking to tweak the standard lead conversion process.
Triggers and lead conversion has always been funky in past projects so I was hoping to start the design off by ...
59
votes
1
answer
114k
views
Using sObject.get() to fetch a field value from a related parent object
I have a contact in a generic sObject in apex and while I'm able to easily get detail field values using
sObject.get('MyContactField__c')
I'm not able to get fields off the related parent object, ...
58
votes
5
answers
8k
views
How can I get 'Recent Items' object Ids in Apex (soql) is it possible
'Recent Items' pane shows recently viewed records for the selected tab. The list is derived from your recent items and includes records owned by you and other users.
Is there any way to get this in ...
58
votes
2
answers
64k
views
Apex List For Loops 101
I just have a simple question about how list for loops work that has been bugging me. Does the for loop variable refer to the actual list item? Here's what I mean:
Say I have a list of accounts.
...
57
votes
7
answers
38k
views
How can I get a debug log for the sites guest user/public profile? [updated for Spring 18]
Normally, you can put debug monitoring on a user by name to see the details on the error they're getting (especially for the non-descript Error Loading a Visualforce Page).
But when you are trying to ...
57
votes
6
answers
31k
views
Can report data be accessed programatically?
Is there any way to access existing reports and their data to be used in apex? Sure, I could write the SOQL manually but if I want it to mirror a specific report I would have to make code changes ...
57
votes
1
answer
1k
views
How does Salesforce determine where to apply the "*** Skipped X bytes of detailed log" section in a log
Firstly, this question isn't about how to access missing log content when a *** Skipped 53353122 bytes of detailed log style message is encountered. That is covered in another question and revolves ...
56
votes
6
answers
47k
views
Deleting Triggers/Classes from Production
I was recently told ( Deleting a Class with IDE - cannot delete from Production? ):
You cannot delete a class in production directly. You will need delete
the class from your sandbox and then ...
55
votes
3
answers
5k
views
Should we use process builder at all?
Forgive me if this isn’t an appropriate topic for this board but I would like to have an open and honest discussion about Process Builder.
We have a multi-tenant org (different business units using ...
54
votes
8
answers
73k
views
How Can I Tell the Day of the Week of a Date?
I'd like to build in some logic based on the weekday (e.g. Monday, Tuesday, Wednesday) of a given date. How can I identify the date, using either formulas or Apex code?
54
votes
1
answer
16k
views
What are the object and field name suffixes that Salesforce uses? Such as __c and __x
When working with API names for objects and fields they will often have suffixes such as __c and __x.
What suffixes are there and what do these API name suffixes indicate?
53
votes
8
answers
36k
views
Target inner elements of standard Lightning Web Components with CSS
Say we have a LWC with the following template in a component named example:
<template>
<lightning-textarea class="test"></lightning-textarea>
</template>
And some css to ...
53
votes
3
answers
11k
views
Where are all past Salesforce Release Notes
As a follow on to the recently posted question
"What are all of the reasons why Salesforce customers should upgrade the API version on their Apex classes, triggers, and pages?".
Where can I find all ...
53
votes
4
answers
4k
views
Apex debugging in Winter '16 - how well does it work?
This Debug Apex Code in Eclipse (Generally Available) release note says:
The Apex Debugger extends the Force.com IDE plug-in for Eclipse and
behaves similarly to debuggers available for other ...