Skip to main content
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
Results tagged with
Search options answers only not deleted user 286

An sObject represents an object, such as an Account or Campaign. An sObject is the base object for all objects in Apex.

56 votes
Accepted

Error: MIXED_DML_OPERATION on setup and non-setup objects

You can resolve this in your test class by using System.runAs. System.runAs ( new User(Id = UserInfo.getUserId()) ) { ...your setup-object DML... } If you need to do this in a non test scenari …
Mark Pond's user avatar
  • 23.1k
3 votes

Can't set property value for SObject using setType function

SObject Type It looks like you have been given the Partner WSDL, this provides a generic "database like" API into Salesforce, so you need to use the SObject type which is a generic way of representing …
Andrew Fawcett's user avatar
17 votes
Accepted

How do I get the list of fields of sObject

UPDATED: Following comment request see below for related fields There is no method on the SObject class that can be used to determine if a field has been queried. …
Andrew Fawcett's user avatar
3 votes
Accepted

Fetching SObject Id from changes in Lookup fields using History tracking

Firstly a with pleasure +1 on the quality of your question! Yes it seems a shame to have to query the database to check this. The following use of Id.valueOf might be preferable for you? Though does …
Andrew Fawcett's user avatar
6 votes

Importing string typed data into an sobject

The key to this is to use the Apex Describe functionality against your object and key names (your field names) in your map. This will give you the type information you need via DescribeFieldResult, to …
Andrew Fawcett's user avatar
5 votes
Accepted

How to retrieve a value from a parent field with SOQL via partner API in java

If the field is a relationship field you need to cast it to XmlObject and then use getChild for the specific related field you referenced in the SOQL. Its not very elegant to drop down into XML termin …
Andrew Fawcett's user avatar
36 votes
Accepted

Generic Apex Trigger

I would ensure however your method takes a list of SObject so it can implement bulkfication. … public class AutoTaskCreation { private List<SObject> Records; public AutoTaskCreation(List<SObject> records) { this.Records = records; } public void onHandleAfterInsert( …
Community's user avatar
  • 1
2 votes
Accepted

"New Action" vs "New Button or Link" for a custom object

These relate to a new feature to extend Chatter in Summer'13, allowing you to add your own actions for users to select when responding to comments left directly in the Chatter feed. I've seen them c …
Andrew Fawcett's user avatar
21 votes
Accepted

Adding an error on a dynamic referenced field

I've searched for workarounds and can find none, the addError methods on SObject use a highly specialised way to reference the field which is to hard code the field reference ahead of the method. … This method is highly specialized because the field identifier is not actually the invoking object—the sObject record is the invoker. …
Andrew Fawcett's user avatar
3 votes
Accepted

Testing code that depends on an SObject

This would require you using this in your UsageStatsWrapper class as apposed to SObject directly, e.g. UsageStatsWrapper(ISObject objectInstance). … The runtime implemetnation of the class would receive the SObject itself and the 'get' method simply delegate to the real SObject.get method. …
Andrew Fawcett's user avatar