Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Questions relating to Apex, the native programming language for the Force.com platform. Use it for general questions on syntax, errors, constructs, and rules of use. Most questions should include a code *excerpt* to help answerers understand specifically what has gone wrong or why you need help.
7
votes
Caching Expensive Results
Session/Local storage is definitely the way to go looking forward, as it's lightning fast, gives you plenty of storage space, and is all client-side, so after the first call there's no work at all done in Apex …
12
votes
Can I tell which fields are present in an sObject variable?
You can use JSON.deserializeUntyped() to convert any JSON-serialized SObject into a Map<String,Object> containing as its keys fields actually present on that SObject. Using your example with Account:
…
4
votes
No such column Location__c using Geolocation field beta
component reference suffix is __s, for example, if you have a loc
field,
you can use loc__Latitude__s, and loc__Longitude__s to get the
latitude and longitude of the loc field in formula and in SOQL/Apex …
4
votes
2
answers
536
views
Determine from Apex (or API) whether Google Apps integration is enabled
Is there any way to determine from Apex (or through the API if not in Apex) whether a Salesforce org has the Google Apps integration enabled? … If so, is there any way to access from Apex/API some of the Google Apps to Salesforce integration data, e.g. the user-specific Gmail-to-Salesforce BCC address? …
0
votes
Configure Installed Package from APEX
I think it is a good best practice for ISV's with protected custom settings to provide some Apex utility methods for modifying them as the ISV deems appropriate. …
1
vote
How can I get a Web Tab's URL from Apex?
hassle just to send a user to a web tab (see eyescream's answer), if you really really absolutely had to do this, here's a completely server-side solution:
1) ON Package Installation, either from an Apex … 2) Cache the result of this describeTabs callout in a Custom Setting (as per Abhinav Gupta's suggestion), ideally just stripping out the most important information, putting it in a custom Apex class or …
9
votes
50,000 query row governor limit
You don't need to do any sort of count query or roll-up summary at all --- a single Batch Apex class could iterate over millions of records if it needed to. … transaction -- but each time that the your Batch Apex class's execute() method is called constitutes a new transaction, so that Limit is reset every time that method is called. …
6
votes
Accepted
Can I query the translated value and return the key in translation workbench?
There is currently no supported Custom Labels / Translations API from Apex, the Web Services API, or SOQL that you could use to achieve what you're after (the Map<String,List<String>> with the master language … BUT, if you don't, you can get these from the Web Services API or from within Apex through the DescribeFieldResult for this Picklist field, and then doing a getPicklistValues() call. …
75
votes
Accepted
What would be the best approach to get the recordtype id
.');
}
}
}
return mapRecordTypes;
}
TO use this to accomplish your need within a Trigger or other Apex scenario, you can just do this:
// Get all Active Account RecordTypes … Any hard-coded references to non-supported objects will cause your app to be disqualified from org editions which do not support such objects --- but use of Apex system classes and methods is fine no matter …
18
votes
Accepted
How to get the attribute class list
;
Decimal decimalValue = parser.getDecimalValue();
} else if (t == JSONToken.VALUE_STRING){
// Here, to determine advanced Apex object types,
// you may have to apply some Regex or try/catch … stringValue = parser.getText();
if (stringValue.split('-').size()==3){
// We have a Salesforce Date value
Date dateValue = parser.getDateValue();
} else {
// and so on for other Apex …
15
votes
Accepted
Managed Package Integration without Extensions or Dependencies
LEVERAGE NATIVE INTERFACES: You can also leverage built-in Apex interfaces such as Schedulable or Process.Plugin, which expose methods that all of your API classes can implement, providing a consistent … It's all based on storing your "API" within the constructors or properties of user-defined Apex classes. …
3
votes
Accepted
Top 5 opportunities for all users.
Example: a Visualforce page to display top 5 Opportunities for each User
// Apex controller
public with sharing class OppsController {
public List<User> getOppsByUser() {
return [
SELECT Name … = opp.OwnerId))
opp.OwnerDup__c = opp.OwnerId;
}
}
The Apex code could easily be used in an EmailHandler, Batch Apex, or other Apex context to persist or otherwise make use of this data. …
3
votes
Accepted
Why would DmlOptions EmailHeader not work for Event Creation with email notifications?
Varun, I don't think that Salesforce sends notification emails to an internal user when a new Event is created that is assigned to that user. This functionality only exists for Tasks.
To verify this …
5
votes
How to check Administrative Permissions in Apex class
It also gets cached so that you don't have to re-query the User record every time your Apex code wants to check whether the User has a given Permission assigned to them. …
5
votes
Permissionset issue in Apex
There are two categories of PermissionSets that are stored in the PermissionSet object:
standalone Permission Sets (have IsOwnedByProfile = false)
Permission Sets owned by Profiles (have IsOwnedByPr …