All Questions

Filter by
Sorted by
Tagged with
28
votes
2answers
489 views

How to write the superduper (=proper and stable) Custom Save method

Custom Save actions in Apex are tricky! Here are my requirements which I was unable to fulfill without harming the stability of my code: Save for New and Edit (works with record with and without Id) ...
28
votes
2answers
251 views

Unintended polymorphic private method

I've run into an odd case where a base class is calling a private method in a subclass that isn't defined as an override. It's a bit contrived, but demonstrates the issue: public virtual with ...
28
votes
2answers
1k views

Parallel Execution of JavaScript remoting calls

I was hoping to be able to fire off multiple JavaScript Visualforce remoting calls in parallel and have the execute simultaneously, and for me to deal with the responses asynchronously. Whilst in ...
27
votes
4answers
57k views

How to check in Apex if a Text field is blank

I'm unsure what's the shortest and most robust way to check whether a Text field is blank / empty? /*1*/ Boolean isBlank = record.txt_Field__c == ''; /*2*/ Boolean isBlank = record.txt_Field__c == ...
27
votes
7answers
34k views

How to debug the mysterious “duplicate value found: <unknown> duplicates value on record with id: <unknown>” error

I've just spent several hours trying to fix a deployment that was failing with the following extremely helpful error message: Error: objects/Opportunity.object(2098,13):duplicate value found: <...
27
votes
7answers
54k views

Where To start Learning With Salesforce Development

Where should I start learning? There are various topics to learn like Objects, Classes, Apex, Visualforce, SOSL, SOQL, Triggers, etc. There are so many options out there to start learning. I couldn't ...
27
votes
2answers
8k views

Two SFDX project folder structure questions

A default SFDX project is created with these folders: force-app/main/default force-app/test/default under which folders such as aura and classes and staticresources that contain components can be ...
27
votes
3answers
16k views

Scheduling an Apex Job through the ui

I am not sure if my memory is failing me, but I was sure there was a way to schedule an Apex Job through the Salesforce UI. The documentation here only makes mention of using the cron syntax. and ...
27
votes
3answers
7k views

What is the Black Tab?

I've recently seen references to a black tab. E.g. BT link to org: https://na2.salesforce.com/00D300000xxxxxx?blacktaboid=00D300000xxxxxx BT link to managed package: https://na2.salesforce.com/...
27
votes
3answers
7k views

Expression Functions for Lightning Web Components

How can expression functions similar to Visualforce and Lightning Aura Components be achieved within lightning web components? For example, <template if:true={index % 5 == 0}><br></...
27
votes
2answers
15k views

Custom labels in javascript

How one can access custom labels in javascript linked as separate static resource? For example, some user action on the page should trigger confirmation dialog with custom message. And this message ...
27
votes
5answers
9k views

“Could not run tests on class …”

Today, I am writing test code in my Sandbox, and until 15 minutes ago, my test execution was working. Now, all of a sudden, my tests stopped working. I can't run even a single test! Test execution ...
27
votes
2answers
9k views

How to check if any error has been added to a record?

I have created a method which is being called through a trigger. I am adding error to a record if it is a duplicate one using 'addError()' method . Now , I want to cover this method in my test class. ...
27
votes
1answer
4k views

Force.com IDE Debugger. New feature?

Saw this as I was installing eclipse earlier. Anyone know how to tinker around with it?
26
votes
2answers
15k views

What is the best workaround for the 20 field history tracking cap?

Feel like I am missing the point of Field History Tracking. Before going any further, here are the Salesforce Limits from the Salesforce Limits Quick Reference Guide date June 2, 2014: Edition (...
26
votes
2answers
11k views

Visualforce Locale specific date format

How can I go about displaying a date that is formatted to a users locale, for example me and my Australian friends use the format dd/MM/yyyy, while the Americans amoung us use MM/dd/yyyy. I know I can ...
26
votes
1answer
5k views

Creating unit tests without interacting with the database - creating fake IDs

I was at dreamforce this year and I saw a session on testing and have looked online everywhere to try to find this trick the guy did. He was creating sObjects to complete dependencies of other ...
26
votes
2answers
5k views

Bind variable with dotted name not working in dynamic SOQL

As mentioned in this answer, it's possible to use bind variables in dynamic SOQL queries. This seems like a great way to avoid SOQL-injection, and to build a query string once but use it multiple ...
26
votes
2answers
10k views

Can you use generics in Apex?

While researching the possibility of using generics in apex I can across a blog with this: "Generics are partially supported in Apex, you must be using them with Collections and Batch Apex." ...
26
votes
2answers
8k views

Pre-populating fields at record creation in Lightning Experience

With Lightning Experience, we can't use url hacks anymore. I'm fine with that, as this was not a supported solution. However, behind this technical hack was a business need: pre-populate field on ...
26
votes
1answer
3k views

Lightning experience page rendering is slow

I've developed a lightning component(actually about 4 sub-lightning components all included on a main component) that queries for records, displays them to a user, and has a form for contact ...
26
votes
2answers
903 views

Javascript Remoting breaks on complex relationship data

We use Javascript Remoting to retrieve some complex data from the controller. The SOQL query looks like the following: SELECT Id, ( SELECT Id, Sales_Rep__r.Name, Customer__r.Name, ...
26
votes
0answers
408 views

Why new Developer Orgs spun with Environment Hub now have Status=Trial and do expire? I while ago it was Status=Free without expiration

Today I had to spin some new DE orgs via the Environment Hub. I've done this often before and I thought to know the process. But I was shocked after taken a closer look on the orgs, which have been ...
25
votes
4answers
17k views

How to sort Wrapper list?

I have a wrapper class which contains a list of sobjects, i want to have th sorting on the fields of these objects in the wrapper list: The apex code is as follows: Class jobsWrapper { public ...
25
votes
10answers
10k views

Can I compare Profiles?

We have many profiles in our org, and I suspect that some of them are redundant because the person who originally set them up didn't seem to understand the purpose of Profiles (confusion with Roles, ...
25
votes
3answers
2k views

certification scores published?

I have my Certified Force.com Developer exam soon, and I wanted to know if a company can see your actual score or just pass/fail. Also, do companies ever really care/ask about your score? Sorry, i ...
25
votes
2answers
5k views

Force.com IDE isn't storing passwords

I recently installed the latest version of Eclipse (eclipse-java-kepler-R, 2.0.1.20130919-0803) with the Force.com IDE plugin (29.0.0.201310181333). Everything was working fine until this morning, ...
25
votes
4answers
3k views

Need to get logfile smaller

I have a massive log file which breaks the 2Meg limit and hence truncates. There is some information I need that I am logging by doing System.debug However, I don't get to see because of the ...
25
votes
3answers
3k views

Writing too much to debug log would affect APEX trigger or Visualforce page performance?

In order to debug we usually write chunks of data to the debug log using System.debug statements. Will writing too many debug logs affect visualforce page or Apex performance in any way?
25
votes
1answer
9k views

Differences between OAuth Web Server Flow, User-Agent Flow, Username-Password Flow?

The steps for Web Server flow, Username-Password Flow, and User-Agent Flow are different, so which occasions are these three used in and how do I select any particular method for different ...
25
votes
2answers
22k views

What are the Best Practices to study for the Platform Developer 1 exam

I understand they recently changed the tests for the platform developer exam. I am studying to pass this exam and was wondering if anyone has any tips for studying? Thanks to all in advanced!
25
votes
2answers
15k views

security token vs session id vs access token

Are all of these three separate values that are only linked for the same user ? For security token I mean on value that you can take from Setup -> My Personal Information -> Reset security token. As ...
25
votes
6answers
8k views

Scheduled batch jobs and durability

I have a process that runs scheduled Apex quite regularly as a batch job manager. This process runs on a one-time schedule, and looks into a batch job table (custom object). If it finds work to do, it ...
25
votes
6answers
28k views

How do I build a multi-select picklist UI in visualforce?

I want to build a visualforce interface that allows me to display a list of available things on the left, and chosen things on the right? This one is hard to explain, so I've made an screen shot, ...
25
votes
6answers
20k views

Is there a list of Salesforce images that can be used in custom pages and formula fields?

I have a Visualforce page that includes some Ajax functionality as follows: <apex:actionStatus id="searchtStatus" stopText=""> <apex:facet name="start"> Searching....<img ...
25
votes
9answers
25k views

Is it possible to remove/hide the “New” button?

When you click on the Opportunities tab, (assuming you haven't modified standard salesforce layout), you see a "Recent Opportunities" list. At the top of the list, there is a "New" button. Is there ...
25
votes
3answers
8k views

Lightning Web Components - Benefits and Support

Salesforce announced Lightning Web Components in Dec. 2018. In comparison to the existing Aura Framework: What are the benefits of using Lightning Web Components? / How much faster are they? Where ...
25
votes
2answers
8k views

How can I determine how many future calls have been executed in 24 hours?

I just ran into a huge gotcha in Salesforce: the 24 hr limit on # of future calls - cf. http://www.sundoginteractive.com/index.php?/sunblog/posts/governor-limit-gotchas-part-1-the-future-call/. I ...
25
votes
6answers
26k views

How can I execute JavaScript on a SFDC Standard Detail Page?

*NOTE: This is not feasible as of the latest SFDC Releases. * I have a requirement to execute some JavaScript on a SFDC Standard Detail page. Specifically we would like to remove the ability for ...
25
votes
1answer
44k views

What's the benefit of the client secret in OAuth2?

In the OAuth 2.0 "Web Server" flow you are required to have a client secret, whereas in other flows you aren't. I can't find an explicit statement as to why you'd need to have a client secret. Is the ...
25
votes
3answers
6k views

Can I prevent an insert to be rolled back even if my class (later) runs into an exception?

I do some custom logging in my code which basically means I write and update sobject records that contain custom log information. The problem is whenever an exception is thrown in my class the ...
25
votes
4answers
11k views

Using SOQL apex bind variables for date literals (e.g. LAST_N_DAYS, TODAY, THIS_QUARTER)

Is there anyway I can use a variable value for LAST_N_DAYS. For example, I am trying to do something like: Integer lastDays = 7; //... //... List<Opportunity> opportunities = [SELECT OwnerId, ...
25
votes
3answers
9k views

Generically Walk sObject Fields

I've become quite comfortable with writing bulkified triggers that compare before and after values of specific fields. I've bumped into two cases where I'd like to do this generically for all fields. ...
25
votes
4answers
3k views

How to interact with Salesforce Support effectively?

There are times when the only way to resolve an issue is to deal directly with Salesforce Support, such as when you need to ask them to adjust a soft limit for an organisation. This can be a ...
25
votes
2answers
2k views

Is there a defacto 3rd party utilities library for Apex such as Apache Commons is for Java?

I have been developing in Java for some time and have grown accustom to using third party libraries such as Apache Commons for some of the more mundane functions needed in most applications (e.g., ...
25
votes
3answers
533 views

SObjectException No More. Intentional Change?

I found a pretty surprising change in platform behavior today. Minimum Viable Reproduction (MVR) Script It's simple to reproduce. Just run this script in Execute Anonymous: Account a = [SELECT Id ...
25
votes
5answers
23k views

Calling future method from Batch

I have a requirement where a future method need to be called from batch apex ,I came across various articles stating that a future method could not be called from the batch. Is there any alternate ...
25
votes
3answers
14k views

What is the maximum number of items in a SOQL IN clause?

Oracle has a limit of 1000 items for its IN clause. Is there a similar limit in SOQL? The SF documentation on the IN clause does not mention any limit. To clarify the definition of an item, the ...
25
votes
1answer
4k views

Why is internal view state size counted against the developer?

Why is "internal view state" counted against the developer? If I have 4k worth of data in the page view state but the VF page structure uses a myriad of nested <apex: tags, such as <apex:repeat ...
25
votes
1answer
15k views

How to get UserInfo.getSessionId() in Scheduler/Batch

I am building sfdc application that required me to call and do add/update using Http method at vendor application in external server daily. They created one account for me in their application. In ...

15 30 50 per page