All Questions

Filter by
Sorted by
Tagged with
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, ...
31
votes
6answers
28k views

Testing HttpCallout with HttpCalloutMock and UnitTest Created Data

We have a callout to an external webservice that requires retrieving some data from the database via SOQL and then issuing an HTTP GET request, and performing various logic based upon the response. ...
31
votes
1answer
638 views

What are the compiled costs of each Formula function

Each formula function has a compiled cost that contributes towards the hard 5000 compiled character formula limit. What are the current compiled costs associated with each formula function?
31
votes
3answers
4k views

System.scheduleBatch issue

I have tested the new Summer '13 System.scheduleBatch method in a DE org and am wondering if I have misunderstood its usage. My principle reason was because I wanted to know if it would allow me to ...
31
votes
2answers
656 views

How to handle the change to “Salesforce DX project format” and keep the revision history?

Downloaded and took a brief look at the Force.com IDE 2 (Beta) this morning that layers on top of the Salesforce CLI (Beta). As someone with many existing projects containing files that have been ...
31
votes
0answers
742 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 ...
30
votes
2answers
35k views

Creating a custom list-view button that handles multi-record selection

I would like to create a custom button for a list-view that applies the same action to all the selected records in the list view. For instance, in the Cases list-view there are the Change Status and ...
30
votes
5answers
15k views

Detect if Visualforce Page is in Salesforce1

I have a Visualforce page that is used in both Salesforce1 and the desktop. On that page is a button. That button should only display if the user is loading the page on the desktop. It should be ...
30
votes
6answers
41k views

SOQL Alias a column

I am wondering how you would do something simple like this in SOQL. select first_name as name from tableA I can not find any documentation on Aliasing a column which is very common in all forms of ...
30
votes
2answers
20k views

Is there any difference in equals and == for String variables?

if ('text'.equals(str)) or if ('text' == str) Is there any difference? If yes, then what is it? Added, after answered. String q = 'teXt'; system.debug('teXt'.equals(q)); // true system.debug('...
30
votes
1answer
31k views

Initialize Map<String, Integer>

Is there a way to initialize a Map<String, Integer> without using put method ? I saw that for initalize a Map<String, String> : private Map<String, String> myMap = new Map<...
30
votes
2answers
43k views

Round a Decimal to two decimal places

How can I round an arbitrary Decimal to 2 decimal places (hundredths of a dollar)? My first thought was to use the Math Functions ROUND(number, numDigits): Decimal toRound = 3.14159265359; ...
30
votes
2answers
6k views

How are Salesforce1 and Aura related?

I have been playing around with Salesforce1 for a while now. I have also read several (unofficial) links which suggest that it's built using Aura. I downloaded the Aura repo from github and have been ...
30
votes
5answers
14k views

Lightning: Bug in Lightning framework when using aura:renderIf?

I have a Nav component which contains the following: <aura:renderIf isTrue="{!v.showAllProducts}"> <c:showAllProductsCmp/> <aura:set attribute="else"> <c:...
30
votes
3answers
34k views

Use Set<Id> in dynamic SOQL IN-clause in method without Database.query()

I know and love that Apex is automatically converting Set to a valid SOQL string when it is used referenced like Set<Id> ids = ... String soql = 'SELECT ... WHERE Id IN :ids'; and passed to a ...
30
votes
4answers
11k views

Use Salesforce1 mobile app to access camera

I have this requirement : scan QR code and search for the related contact in salesforce and show it in a mobile app. I was wondering if I could do this using salesforce1 mobile app for iPhone/...
30
votes
1answer
3k views

What formulae does the Geolocation Distance use?

Forgive me if this is a bit extremely academic in nature, but I was wondering how Salesforce goes about determining the distance between two pairs of latitude and longitude? When I've looked at this ...
30
votes
3answers
5k views

How to build custom UI that works both for users that have opted in to Lightning Experience and users that have not?

This isn't a question about the pros/cons of Lightning/Visualforce, but is a question about how to build custom UI for the period of time (a year or many years?) where some users/orgs have Lightning ...
30
votes
2answers
724 views

When is SOQL Polymorphism going to be enabled by default?

SOQL Polymorphism (SELECT TYPEOF) was introduced in Winter 13, API version 26 for developer organization. Is this feature going to be enabled by default for production organizations also sometime in ...
30
votes
1answer
1k views

An interface extending a system interface causes process hangs?

We're trying to implement dynamic batch processes to dispatch different classes. Specifically, we have integrated multiple systems, and depending on certain events, we dispatch callouts to those ...
29
votes
3answers
18k views

Force.com IDE does ONLY save to server when explicitely force by “Save to Server”

When I save a change in my Force.com IDE this is not reflected on the server very often. I then have to manually use Force.com > Save to server. I recently upgraded to Eclipse Juno but the problem ...
29
votes
1answer
8k views

Testing AuraHandledExceptions?

It seems like when I call getMessage on a thrown AuraHandledException, I see "Script-thrown Exception" instead of the message that I have set. Any idea why this may be happening? Controller: @...
29
votes
5answers
17k views

Workaround for the 10 web service callout limit in apex?

What are the workarounds for the 10 web service callout limit in apex. If you need to make, say 50 callouts, how do you batch them so that you can execute them all asynchronously? Is there a good ...
29
votes
1answer
17k views

Bug in String.split('.')?

I can hardly believe it but split() doesn't work on the . character: String createDate = '01.2.2013'; String[] cd = createDate.split('.'); System.assertEquals(3, cd.size()); // Boom! Tried with '\....
29
votes
3answers
12k views

When should a static intializer be used?

I come from a C# background, so I was a bit confused when I encountered a static intializer today: public static final Integer MAX_VALUE; // in days static{ Common_Config__c config = ...
29
votes
4answers
8k views

Development Team Best Practices, or “Is this IDE for real? I am in disbelief” [closed]

I have a family of questions that I am piling into one post, because my suspicion is that they will all point to a short list of bad practices that cause these quandaries. The way I have been taught ...
29
votes
1answer
21k views

Populating Custom Settings field using Apex

I'm trying to populate/set/put/initialize a custom setting's field with a calculated value within my apex code. The field type is number. Is there a way to do this?
29
votes
2answers
9k views

Salesforce Lightning Component Cache

When developing a lightning components in the lightning experience, let's say I make a change to custom_componentController.js. If I want to see these changes in the lightning UI, I have to hard ...
29
votes
3answers
4k views

Flows/Processes, Version Control and CI

I've started using Processes and Flows and am really excited about these features -- but am still wrapping my mind about how to manage them in Version Control (which I use) and Continuous Integration (...
29
votes
1answer
1k views

New Schema.describeSObjects not working as expected

There is a new method for Schema in Winter 14 called Schema.describeSObjects. The idea as I understand the docs is that you can pass in a list of sObject names as strings, and get back the describe ...
29
votes
2answers
1k views

Error handling from JS remoting

We are using JS remoting. Found this interesting race condition: JS Remoting AJAX request made by user. Before it completes the user moves to another page When user moves browser to another page the ...
29
votes
0answers
377 views

Mini Page Layout Hovers in Managed Package

Has anyone using the mini page layout popup technique listed here in a managed package had the package rejected in security review because of it? This is obviously an unsupported technique, but given ...
28
votes
8answers
44k views

Export Results from Developer Console - Query Editor?

I'm a huge fan of the Query Editor in the SFDC Developer Console: Is there a way to export the table of results as JSON/csv/excel or in some format that can be consumed by Excel? (I know that I can ...
28
votes
4answers
45k views

How to get salesforce instance url

To access chatter rest api using APEX code, I need salesforce instance server url in following format: https://na17.salesforce.com Is there any method which works in all cases Case 1: Any ...
28
votes
2answers
20k views

@AuraEnabled Support for Apex Class Return Types?

Beginning on page 141 of The Lightning Components Developer Guide, they list the valid types for aura attributes. Apex Classes and collections are included, so I've written an apex controller method ...
28
votes
2answers
36k views

How to get Custom Settings in Apex Test code?

I have a custom setting used by a visual force page to load error messages based on a code value. In my test code for the page I have this statement Integer howMany = Message__c.getAll().values()....
28
votes
3answers
19k views

How should I build test methods for Visualforce Controller Extensions

I would like to know the best way to write test methods for controller extension classes that are used by Visualforce. What is the minimum set code that I need to cover the basic operation of the ...
28
votes
4answers
46k views

How to access outer class instance variables from inner class in controller?

I have an outer class with an inner class as part of a controller. I have tried setting the instance variables in the outer class as static, which allows the code to compile, but after the controller ...
28
votes
1answer
19k views

Error: MIXED_DML_OPERATION on setup and non-setup objects

In my test class i have the creation of a dummy custom setting and a dummy lead: Group g1 = new Group(Name='group name', type='Queue'); insert g1; QueuesObject q1 = new ...
28
votes
2answers
32k views

Apex Cast sObject list dynamically to a specific sObject Type

The upsert() DML operation requires a specific List based on a specific sObject type, for instance:List<Account> lstAccount = new List<Account>(); However, we are trying to generate a ...
28
votes
1answer
3k views

What's the best way to check if person accounts are enabled via Apex Code?

I need to be able to check if an org has Person Accounts enabled via Apex Code as part of package. What's the best way to do this without making the package require Person Accounts be enabled in any ...
28
votes
1answer
1k views

How can you benchmark Apex code to determine what operations consume the most CPU time?

There are multiple reasons why I'm asking this question, and I realize that it doesn't have an easy answer - accurately benchmarking code is difficult. I’m hoping I can craft this post in such a way ...
28
votes
2answers
8k views

How to set up views and navigation in Lightning?

What is the best way to create views in Lightning? 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 ...
28
votes
1answer
9k views

Getting “__r” relationship name from Schema.SObjectType.Fields

Say I have a master-detail relationship between two objects, Schematic__c and Part__c. I can SOQL query the master from the detail: [SELECT Schematic__r.Name FROM Part__c] If I'm building a query ...
28
votes
4answers
3k views

Lightning LockerService and Component Inheritance

(I'm hoping one of the Lightning Component developers will be able to chime in on this, as I'm rather concerned that the LockerService will break code using inheritance) Salesforce are introducing ...
28
votes
1answer
12k views

Why use Test.setCurrentPage() method in a unit test?

What is the purpose of the Test.setCurrentPage(..) method and why would I use it in my apex controller unit tests? According to the salesforce docs, https://www.salesforce.com/us/developer/docs/...
28
votes
2answers
4k views

Requirescript change in Winter '16 release

As per release winter 16 release notes: http://releasenotes.docs.salesforce.com/en-us/winter16/release-notes/salesforce_release_notes.htm In summer 15 release salesforce disabled JavaScript hacks ...
28
votes
2answers
621 views

API v40 slows down Apex generated data in Lightning Components

Given a super simple scenario loading a list of 2000 Strings via Apex controller. When I process the list in a Lightning Component, there is a huge difference in performance between API v39 and v40. ...
28
votes
2answers
5k views

Different Session Ids in Different contexts

I'm dealing with quite an unusual issue here, and was wondering if anyone had figured this out. I'm trying to implement an OAuth flow from one salesforce instance to another (any other). And one of ...
28
votes
1answer
369 views

Strange Allowed Apex Syntax

Found some crazy apex syntax and I have no clue what it does. public Account<List<String<Contact>>> whatIsWrongWithApex; Is this a defect? Should this do something? Compiler not ...

15 30 50 per page