superfell
  • Member for 9 years, 5 months
  • Last seen more than a month ago
Breaking out of a nested loop
Accepted answer
23 votes

One easy way, and which gives some nice structure to the code is to make the inner loop a separate function, e.g. while(!stack.isEmpty()) { Frame frame = stack.top(); if (frameCondition(frame)...

View answer
Can you use the LIKE operator in SOQL queries via the REST API?
Accepted answer
21 votes

Yes you can. SOQL in the rest API supports all the same constructs that its SOAP older brother does. Remember to pass the SOQL as the 'q' parameter in the URL,and to URLEncode the soql when putting it ...

View answer
Archaeology: what happened in Salesforce API 11.1 to necessitate a point release?
Accepted answer
18 votes

That's going back a while now. API v11.1 was released to support the first release of the identity confirmation features, including the API security token, login confirmation codes for new browsers ...

View answer
@Future at risk for race conditions?
Accepted answer
17 votes

@Future's are queued transactionally along with other db changes in the trigger transaction, so the future can't be executed until the enqueuing transaction commits. (and conversely, if the trigger ...

View answer
SOQL Record Locking (FOR UPDATE)
Accepted answer
17 votes

FOR UPDATE will take an underlying database write lock on the selected rows, other requests that require the lock while another thread has it locked will wait a short amount of time (in the order of 5-...

View answer
SOQL result ordering in the absence of an Order By clause
Accepted answer
15 votes

If you don't specify a where clause, the order of the returned rows is undefined, and a whole host of things can affect it including which columns you select,what your where clause is, if its a ...

View answer
Is sending feedback on SFDC Doc errors/incompleteness worth bothering about?
Accepted answer
14 votes

These reports go directly to the doc writer team, and by far is the quickest & easiest way to give feedback and get improvements in the doc, and is at least as effective as getting bugs logged in ...

View answer
Why is my SOQL query slow the first time, faster subsequently?
14 votes

Short Answer: because its a RDMBS backing it. Longer Answer: Your data is ultimately stored as blocks on some storage device somewhere, if not recently access the database will have to go read those ...

View answer
Workflow - Outbound Message lost?
Accepted answer
12 votes

Outbound messaging implements an at least once delivery protocol on top of SOAP, the server will try to send the message until it has been actively acknowledged by the receiver (by returning true in ...

View answer
What does object.isQueryable() actually mean?
Accepted answer
11 votes

isQueryable means the object is queryable as a top level object, e.g. you can do select id from Foo__c Some objects, e.g. Name are marked as isQueryable=false, and are only accessiable as a ...

View answer
At what point in the transaction lifecycle is SystemModstamp set?
Accepted answer
11 votes

generally sysModStamp is sent when the row gets written to the db, but with triggers, workflow etc, there's no real way to generalize when it gets set vs the lifetime of the transaction. Its ...

View answer
Native JSON parser issue
11 votes

As per the json spec, null is represented by the keyword null, so this seems right.

View answer
Isn't ContentVersion 'VersionData' Updateable (Amendable)?
Accepted answer
11 votes

As you mention ContentVersion is not updatable (versions are explicitly immutable, a feature of the content product), you would have to stage the blob somewhere else (perhaps an attachment) until its ...

View answer
Get the sObjectType of a field dynamically
Accepted answer
10 votes

In the describe for the Field there's a referenceTo property which indicates which type(s) the foreign key is for, e.g. system.debug(Schema.SObjectType.Contact.fields.AccountId.referenceTo[0]....

View answer
Sending a blob from Salesforce in a HTTP request?
Accepted answer
10 votes

You can use the setBodyAsBlob(Blob someBlob) method on HttpRequest to send a raw blob in an HTTP request. If you need to send a mime multi-part request, then that's harder as there's no good way to ...

View answer
Give lookup field External Id in JSON request
Accepted answer
9 votes

It works the same way as in SOAP & Apex, you pass a nested object of the related type, specifying its external Id, e.g. here's a payload to create a contact, and specify the account by an account ...

View answer
Field History Tracking - OldValue and NewValue null?
Accepted answer
9 votes

This is a bug in the eclipse plugin, if you use another tool like workbench or SoqlX you'll see the real data.

View answer
How can I determine what org edition I have
Accepted answer
9 votes

Log in to the org, its part of the page title, e.g. "salesforce.com - Developer Edition"

View answer
Store Salesforce credentials
Accepted answer
8 votes

You should do an OAuth login flow and store the refresh_token rather than storing raw credentials. Encrypting the value and managing the key outside of the db would help increase security as well. ...

View answer
Freeze User through code and make report on them
8 votes

the UserLogin SObject has an IsFrozen field, you can set this to true (from apex, api etc) to freeze a user. You can query this field from SOQL to determine who is frozen (and also who has a password ...

View answer
Way to identify API usage and limits using API?
Accepted answer
8 votes

There's currently no API access to see the API call counts/limits. You can run a report that shows usage over the last 7 days (see the administrative reports section)

View answer
Error logging in via API
Accepted answer
8 votes

That's an explicit error returned from the server, so you request made it to a server and back. did you deploy the config file for your app (is this a desktop app or a web app?), as normally the .NET ...

View answer
Avoid hardcoding endpoints in external applications which call custom apex webservice
Accepted answer
7 votes

You need to hard code the path but not the server, most languages these days have URI classes that make putting the require URL together pretty easy, e.g. // build a URL object for the regular server ...

View answer
Serialize Class to JSON with correct sObject API field names
Accepted answer
7 votes

You could using the stream JSON api to build your json, or you could build a Map that represents your record, and use regular JSON.serialize to build the json, that's probably easier than the ...

View answer
FOR Loop Gives Last Value in List Each Time
Accepted answer
7 votes

You're getting the same data over and over again because when you build the objects list, you put the same object instance in it every time. The code that builds the objects list is wrong, you're ...

View answer
Is it possible to store and reuse a refresh token ad infinitum?
Accepted answer
7 votes

The refresh token doesn't expire, but can be manually revoked, so you do need to be prepared for the case when your refresh token is no longer valid, but generally this should work fine. But, there's ...

View answer
Overcoming Database.com latency
Accepted answer
7 votes

Round trips will kill you, so you want to do as much as possible in a single round trip, one thing you could do is encapsulate your multiple queries into a single operation using a custom web service (...

View answer
INVALID_SESSION_ID: This session is not valid for use with the API, when calling SOAP API in old fashion
Accepted answer
6 votes

If the org has white listing turned on (e.g. only these approved apps can connect) then anything else won't be allowed to login. Is there a reason why you're not doing an oauth flow to authenticate ...

View answer
Performance comparison - repeat loop vs more in one loop
Accepted answer
6 votes

In general less loops is better, as this can lead to better chances to not thrash the L2 cache on the CPU, however there are so many levels between there and your apex code that the odds of you ...

View answer
Error when doing a test callout to a REST web service
Accepted answer
6 votes

Turn off compression, this worked fine for me from from anonymous apex. String content = '{"NumerVidskiptamanns": "500269677900", "Heiti":"Test"}'; HttpRequest req = new HttpRequest(); Http http = ...

View answer
1
2 3 4 5