All Questions

Filter by
Sorted by
Tagged with
36
votes
2answers
2k views

Why Would I Not Enable Chaining?

The Apex Design Patterns is an awesome resource, and I learned many tricks from it. One of my favorites is method chaining, and I quickly developed an axiom: Any time you would return void, return ...
36
votes
4answers
281 views

Ideas that every salesforce developer should vote for? [closed]

I've noticed that Ideas around improvements to the apex language don't seem to get the same up-vote exposure as some of the admin-based improvements. Thinking this might be a good place to ...
36
votes
2answers
21k views

Dynamic number of columns in a pageBlockTable

I would like to be able to dynamically control the columns displayed in a page block table. This would mean that if new fields are added to the object the controller and page do not have to be updated....
36
votes
2answers
3k views

Dev Console jumpy on mouse scroll

Since yesterday my dev console is jumpy when I scroll with the mouse wheel. I use windows on chrome at 80% zoom default. Putting it back to 100% zoom does not fix the problem. I only have this ...
36
votes
1answer
15k views

How does SalesForce calculate Data Storage usage amount?

My company has recently exceeded our data storage cap (at 102% right now.. :/ ). A large portion of the data that pushed us over our limit was due to an import of records. The weird thing about this ...
36
votes
2answers
3k views

Ghost Schedulable Classes Blocking Deployment

Recently I've been running into issues where deployments were blocked due to a Schedulable job pending or in progress when I'd already cleared the Schedulable job from that class. Any tips for ...
36
votes
3answers
6k views

How to use GIT on multi dev environment

I have previous experience using GIT in other development environment and I never had much troubles using it. We where using SVN for salesforce, however we want to migrate to GIT for the uncountable ...
36
votes
3answers
15k views

Workaround for Offset 2000 limit on SOQL Query

Problem I'm trying to make a standard query pagination. I'm using SOAP API. The logic is classic: LIMIT recordsByPage OFFSET (recordsByPage*pageNumber)+1, It works fine, however, I'm facing the ...
36
votes
3answers
5k views

How do I get the intersection of RecordType and Picklist values inside Apex?

Context This question has been asked before in the past and I've found several discussions of it here on StackExchange and elsewhere (links below to pages I've found in my research). So far I'm not ...
35
votes
6answers
18k views

Using APEX to assemble HTML Letterhead Emails

I am looking to assemble an HTML Letterhead Email Template for an email service integration project. There are two sObjects that hold this information - EmailTemplate and BrandTemplate. ...
35
votes
1answer
5k 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?
35
votes
3answers
7k views

How to deploy apex classes that are scheduled

This is related to Is there any way to unschedule an apex scheduled job programmatically?. I noticed user320 mentioned there is a way to use Type.forName to decouple your classes from the scheduled ...
35
votes
5answers
16k views

Object Deploy fails with: “duplicate value found: <unknown> duplicates value on record with id”

When I try to redeploy an object that exists in source and destination orgs, the deploy fails with the cryptic and useless error message: duplicate value found <unknown> duplicates value on ...
35
votes
8answers
13k views

Apex Code Coverage: Test classes are included with 0% in overall code coverage calculation

We are making heavy use of stub and mock objects in our Apex tests. Most of the time we are defining the mocks as inner classes of our test classes. We have noticed, that test classes, which do ...
34
votes
2answers
19k views

Error while updating debug log trace flag

I am trying to update the debug log trace flag for my user but getting the following error Having an active trace flag triggers debug logging. You have 259 MB of the maximum 250 MB of debug logs. ...
34
votes
3answers
21k views

How to use fieldsets with Lightning?

Been trying to figure out how to create a salesforce Lightning input form, based on fields from a fieldset. As an aura enabled apex method is not allowed to pass an entire fieldset I tried by ...
34
votes
5answers
33k views

Howto wildcard SELECT * to query all fields of objects in APEX?

I have created sObject and I need all the fields and I have many. Is there a way I can directly get all of them rather then typing each one of them.
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 ...
34
votes
4answers
6k views

Namespace Prefix in JavaScript and Apex within Installed Package

When you have a dedicated Visualforce Page and can use modern JavaScript Remoting techniques, this is seldom an issue. But I'm looking at some historical code in a managed package like this: {!...
34
votes
3answers
9k views

Is there any way of confirming that an @future method has been called/queued in a test class?

I have a Controller (FooController) which calls an @future method (bar()) belonging to another class (FooServices). Ideally in my test class for this Controller (FooControllerTest) I only want to ...
34
votes
2answers
6k views

When To Use Set vs. List In SOQL

I have always assumed that it is better to use a Set in my query filters instead of a List. For example: Set<Id> parentIds = generateParentIds(); List<Child__c> children = [SELECT Id FROM ...
34
votes
1answer
4k views

What are Lightning Web Components

Salesforce has just announced a new feature, Lightning Web Components. What is this? What does it have to do with Lightning Components and the Lightning Component Framework?
34
votes
1answer
25k views

Writing Test Classes for Apex RestService

I was writing test classes for my apex Rest Service that i had built for an ipad app. I noted very interesting things while experimenting.Before anything i just did a google and found an interesting ...
34
votes
4answers
6k views

Documenting Salesforce.com Apex class files

[I asked this question on Stack Overflow but didn't get any answers there.] Since the Salesforce.com Apex language is "Java-like", I'd like to use javadoc or Doxygen to generate API documentation for ...
34
votes
2answers
8k views

How to use Advanced Currency Management (ACM) in Custom Objects?

I've been searching for the last two weeks about how to implement Multi-Currency correctly in our organization. I'm pretty sure I'm not the only one who noticed that if you want to use the Advanced ...
34
votes
3answers
699 views

Spring 14 Limit change can break existing apps even when running previous version API

I'm looking for confirmation that what I'm seeing is real, and if this is a bug or an intentional breaking change. Create the following test class: @istest public class TestLimits{ public static ...
34
votes
2answers
312 views

Which kind of issues will be shown at trust.salesforce.com and which issues will be omited?

In the context of a different question, we encountered a deployment performance degradation on EU5 of between 6000% to 10000% using Metadata-API. This means that work (saving a single APEX file to the ...
34
votes
2answers
404 views

Related Objects in User.layout Metadata on Winter '14

What's going on with the layouts/User-User Layout.layout metadata file? I have scripts that snapshot all of my metadata every day. Ever since we upgraded to Winter '14, the following lines are ...
33
votes
10answers
2k views

How can I cause side effects outside an execution context?

I've got a scenario that relies on the system's "automatic rollback" behaviour to undo any DML, emails, futures and so on, in the case of an error. Basically, by allowing code to throw an unhandled ...
33
votes
2answers
30k views

HTTP Callout from Triggers

I have a trigger on the Custom Object that calls a class. That class makes an HTTP GET request to a Web Service. However I get the following error: Callout from triggers are currently not supported. ...
33
votes
11answers
20k views

Get Site URL from apex

Is there a way to get the URL of a salesforce site from apex I need this to send the url in an email message, so the apex is run outside of the site context. I basically want to expose a link to my ...
33
votes
1answer
6k views

Generic Apex Trigger

So I was kind of throwing round the idea of making a generic apex trigger that is callable by multiple objects. Say you have the following sObjects: Account Sales__c Sales_Contacts__c And I wanted ...
33
votes
5answers
3k views

Developer Accounts for ExactTarget

Has there been any progress made on granting a developer account for SF and HubExchange Devs? It feels conceptually wrong to me a SF product doesn't allow developers to perfect and develop a wider ...
32
votes
5answers
73k views

list.IsEmpty() vs list.Size() > 0 vs list != null

I want to check the list is empty or not if not proceed further. So, which is preferable in apex and what are the differences between them? if(myList.size() > 0) or if(!myList.isEmpty()) or ...
32
votes
3answers
14k views

Return Name of class from instance of that class

I need a quick approach to something like: MyClass mc = new MyClass(); String theName = ClassNameProvider.getName(mc); // returns 'MyClass'
32
votes
2answers
7k views

Is there any way to unschedule an apex scheduled job programmatically?

Is there any way, either using apex or the API to unschedule a scheduled job?
32
votes
5answers
11k views

Refreshing Formula Fields Dynamically (without save)

I have an "invoice" custom object which has a couple of summarising formula fields in. I also have a complicated and dynamic visualforce page for building the invoice objects. As the user is ...
32
votes
3answers
8k views

Recover a sandbox after accidental refresh/deletion

I have refreshed my sandbox accidentally. Is there a way to get back the old copy of my sandbox? I did not use clear case or svn.
32
votes
1answer
44k views

How do I build a SOQL query for records in a list of IDs?

Can some one correct my soql? I need to export records in data loader like: WHERE Id IN ('123123123','123123fsdf') But this following query does not work for me: SELECT Id, Syndication_Documents__c ...
32
votes
3answers
16k views

Is there a difference between an Array and a List in Apex?

In the Development with the Force.com Platform book on pg 130, they mention that an Array's length is fixed when you initialize it and that multidimensional arrays are not supported. I just tried ...
32
votes
7answers
12k views

Obtaining all ContentDocument records using SOQL

According to the Salesforce documentation on ContentDocument Users (including users with the “View All Data” permission) can only query files they have access I find this very strange. Why would a ...
32
votes
1answer
5k views

Can I have a public APEX REST API?

Can I have a public APEX REST API e.g. APEX REST api that is accessible without authentication?
32
votes
3answers
2k views

What to Javascript-test in Lightning components and what not

Let's be honest. As an Apex developer used to provide near-100% test coverage for Apex the same should be true for Lightning components. As we move more code from the server to the client more test ...
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 ...
31
votes
5answers
59k views

Apex: Dynamically get fields for an SObject - no hardcoding

It states in Salesforce Apex docs that I can get fields for a particular SObject (standard or custom) in the following way: Map<String, Schema.SObjectField> M = Schema.SObjectType.Custom__c....
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....
31
votes
5answers
5k views

(Why) Should I Use Lightning Apps?

I have looked through the documentation and Trailhead, and I have started building some Lightning Applications. I still do not understand what makes Lightning Applications better than standard ...
31
votes
2answers
38k views

Is it possible to test list size from a VisualForce page?

Consider a simple example of a VF page that shows an account, with a pageBlockTable to display contacts on the account. But if there are no contacts for the accounts, instead of an empty table we ...
31
votes
2answers
16k views

How to access profile permissions via API

If I know the name of a certain profile, I would like to obtain CRUD permission settings for each object in the profile using Apex. I see that there is an sObject called Profile, but this only ...
31
votes
4answers
11k views

Custom Exception with a constructor that takes parameters

I'd like to extend Exception to create a custom exception class that takes several arguments in addition to the standard string message. I've found examples showing basic inheritance (An Introduction ...

15 30 50 per page