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

learn more… | top users | synonyms

3
votes
1answer
69 views

How can I get the opportunity owner label?

Simple question. How can I get the opportunity owner label name? I tried the following code but it isn't working. An error occurred. {!$ObjectType.Opportunity.fields.Owner.label} I cannot use the ...
6
votes
2answers
112 views

Set Contains method is not working correctly after overriding equals() and hashcode() methods

I have created one class name like Test and have overriden its equals() and hashcode() methods and then created its 2 objects like below - Test obj1 = new Test (); Test obj2 = new Test (); and now ...
0
votes
1answer
39 views

how to get owner name, record type name, Account name on trigger of Contact

I'm writing custom history tracking code, tracking needs to be done for more than 50 fields All working fine, but instead of record type name , I'm getting record type id, and the same is happening ...
1
vote
1answer
29 views

Get one value from a list as an integer

I am having trouble updating a variable because of various errors. I cannot get the value from my list to work with the value of my other list. trigger StudentNoUpdate on Class_Size__c (before ...
1
vote
1answer
21 views

Create dropdown list of pricebooks

I'm in the process of creating a variable dependent picklist, where you can select a pricebook from a dropdown and then a multiselect picklist will show the products in that pricebook. So far, I have ...
0
votes
0answers
21 views

User Record Access on Account Team Member

I'm using the User Record Access object to check a user's permissions when it comes to editing/reading the Account Team Member object, but it seems like it is always false for both hasEditAccess and ...
4
votes
1answer
122 views

Using a generic SObject in VisualForce Page

I have a wrapper class that I want to reuse for Both Accounts and Contacts public class SelectableSObject{ public Boolean selected {get; set;} public SObject obj {get; set;} } In the ...
2
votes
1answer
77 views

How can I dynamically transverse dynamically SOQL'd SObject fields in Apex?

So, in my other post, I figured out for myself how to dynamically transverse SObject fields in Apex. But within the context of my work, there is a problem with the solution as it currently stands: ...
1
vote
0answers
25 views

ExactTarget Landing Page form - getting a ExactTarget error message if two non-required fields are empty

I have an ExactTarget Landing page form that create a SF Lead when submitted. If every field is filled out(approx 20 fields) everything passes into SF with no issue. The problem is this - of the ...
1
vote
1answer
37 views

Is it possible to use SObject Formula fields to get arbitrary values stored in some other SObject?

Let's say I have some SObject (myCode__c) with three string values (e.g. key1__c, key2__c, and code__c). The combination of key1__c and key2__c should be unique. Let's say I have a second SObject ...
4
votes
1answer
66 views

How can I dynamically transverse SObject fields in Apex?

I am trying to dynamically create a CSV file from Case records. The fields for the CSV file will be determined in custom settings (and therefore shouldn't be hardcoded). Moreover, the fields may ...
2
votes
1answer
427 views

apex:inputField can only be used with sObjects

I am trying to create a custom visualforce page that saves new opportunity contact roles to an opportunity. I am having trouble creating the first step of listing out all contacts that relate to that ...
1
vote
2answers
42 views

Can I tell if I queried a field?

I have some code that queries some fields from an object. I then use the schema to loop over all of the fields of an object. Is there a way, while I'm looping through the schema to tell if I had ...
1
vote
3answers
35 views

SOQL - Listing out down columns of a SObject

In Oracle, I can issue the following command to get me the table structure and list down all the columns of a table. desc table_name TABLE COL1 <DATA TYPE> <NOT NULL ETC> COL2 ...
3
votes
1answer
41 views

Issues with a Query within the main Query using DatabaseDotcom Ruby gem

I'm having a issue with pulling the data out of what would be a array of object data in my SFDC query. Im using the databasedotcom gem. Code def self.data_query #@client is defined at a class ...
0
votes
0answers
26 views

Partner Users cannot access User lookups

We have a situation with our partner users such that SFDC doesn’t allow partner users to access user records in user lookup fields on the opportunity. The affect is that they are unable to ...
7
votes
1answer
405 views

Finding a Custom Object Id (01I…) to get the Setup page URL

I'm trying to find a way to get the "Id" for a custom object's setup page. So I'm NOT trying get a record Id. I'm working on a custom visualforce page and I'm setting up a link so that when the user ...
1
vote
1answer
28 views

What is the best way to add to an apex collection of String

Is there a more efficient way to Select data into a String collection e.g. Set<String> than using a for loop Set<String> allTopicSet = new Set<String>(); for (Topic t: [select ...
2
votes
2answers
131 views

Can I set sobject id in a method?

Apex code developers guide says "The ID of an sObject is a read-only value and can never be modified explicitly in Apex unless it is cleared during a clone operation, or is assigned with a ...
2
votes
0answers
45 views

sObject insert execution not synchronous

I have a custom object and a controller action that creates a new record of this type. The action then returns a page where the list of objects are displayed. save() { ... insert myObject; ...
1
vote
2answers
124 views

Change the field of another object before insert

I have two Objects : Activities and Services, with each field. I create a Trigger (Before Insert) on the Activity, in the Trigger I would like to modify the fields of a record of the Service object. ...
3
votes
1answer
52 views

Can a Web Tab's url be get and set from Apex or the REST Api?

I would like to modify the url of my Web Tab for each SF organization that my managed package is installed on. Is there a way to get and set the url of a Web Tab from Apex or the REST Api? Is there a ...
1
vote
1answer
604 views

Calling Apex class from trigger - issues with passing a list

I am trying to call my Apex class from a trigger: trigger newCrossSellAccounts on Account (before insert) { crossSellModule.insertAfterAccount2(trigger.new); } On the class I have: public void ...
3
votes
4answers
175 views

Creating list from custom objects with relationship

I want to create a list in order to use it in a vf page with the tag apex:pageblocktable. The schema below is just for learning purposes, it has 3 custom objects with look up relationships. I had ...
2
votes
0answers
26 views

Problem with reports after install

I've recently created a package and I'm facing an unusual problem. Basically, in my development org, this works: String report = String.valueOf([SELECT Id FROM ...
1
vote
2answers
27 views

Customize User SObject field labels

How can I customize the custom field labels of the User SObject? For other SObjects you can use the "Rename Tabs and Labels" setup entry. However, because the User SObject has no Tab, this isn't ...
2
votes
3answers
148 views

Can't set property value for SObject using setType function

I'll get my excuses in early: I'm a developer with some experience of working with APIs, but this is my first encounter with Salesforce. We've been given a spec to interface with a customer's ...
2
votes
3answers
911 views

Maps: adding more (related) sObjects than key values using PUTALL method

Here's the scenario: you've loaded a bunch of account IDs as keys into your map. But now, instead of loading account records as the sObject values, you're going to load a related object, such as ...
2
votes
2answers
1k views

How to add a lookup field value to an sObject list

Since I started coding in Apex, I've gotten used to working with lists of IDs of objects not the objects themselves. This time around, instead of creating a List of account ids, I created a List. ...
1
vote
3answers
159 views

System.NullPointerException: Attempt to de-reference a null object for duraion

I am new to Apex coding. Can someone please help me to resolve the issue. I am trying to automatically display the duration when from and todate is selected. For that i have developed a code in the ...
1
vote
3answers
148 views

Where can I get more information about Owner?

There were one time that I was trying to get the Owner name from Case. I searched online and knew that I can use the following query to achieve: Select Id, AccountId, Owner.Name, Owner.Email, ...
6
votes
3answers
253 views

How do I SOSL across objects, matching all records with FIND clause?

To all the expert SOSL gurus lurking out there, I thought this will be an interesting one: I have some SObjects of different types and I want to return their Name values in a single query. In ...
8
votes
2answers
4k views

Using sObject.get() to fetch a field value from a related parent object

I have a contact in a generic sObject in apex and while I'm able to easily get detail field values using sObject.get('MyContactField__c') I'm not able to get fields off the related parent object, ...
10
votes
1answer
105 views

Archaeology: what *was* object type 004?

So we've all eyeballed the various standard object Key Prefixes at some point and noted: 001 is Account 003 is Contact etc I've always wondered: what was 004? What about 002?
2
votes
1answer
1k views

How do I get the list of fields of sObject

My code is myOutput = SELECT location__c, level__c, group__c, count__c from resource__c public sobject[] data = Database.query(myOutput); myOutput is an user input value, based on this query I ...
2
votes
1answer
382 views

Create one table of multiple object types

I am looking to create a table, for instance pageBlockTable, with entries from multiple object types. The various objects share some fields, and also have unique fields. The table should display a set ...
4
votes
1answer
258 views

Instantiate an instance of the SObject type

Is there a way to instantiate an SObject without a SOQL query? This works : Type t = Type.forName('Account' ); Account o = (Account) t.newInstance(); But this doesn't : Type t = ...
3
votes
1answer
128 views

REST API Sobject GetUpdated/GetDeleted on sobjects returns The requested resource does not exist

I am trying to use the following - http://www.salesforce.com/us/developer/docs/api_rest/Content/resources_getupdated.htm On 'Document'. Authentication and everything is successful, even calls to ...
6
votes
1answer
90 views

Why doesn't SFDC allow MIXED_DML_OPERATIONs anymore?

Okay, I know very well by now that SFDC does not want and often does not allow us simply insert and/or update Setup and/or "Non-setup" sObjects in the same context anymore, something I used to do with ...
3
votes
1answer
179 views

Fetching SObject Id from changes in Lookup fields using History tracking

I have set history tracking for my Custom Object and set a Lookup field for my referenced Object. CustomObjectX_c[Field1,Field2,Account_c] Here Account__c is a lookup field to the Salesforce ...
3
votes
1answer
200 views

Is it possible to write a method that accepts both SObjects and Apex Class Instances?

I have an Apex method that takes a list of SObjects, a source field name, and a destination fieldname. For each SObject in the list, it looks at the source field, does some work, and populates the ...
7
votes
1answer
468 views

Importing string typed data into an sobject

I have a relatively large Map<String, String> which is basically a key/value map of sobject field names and their values. Obviously, all the values are strings, but fields are not (there are ...
5
votes
1answer
211 views

Update Record via @RestResource class, return related SObject

I'm trying to create a REST API class that will allow the following: POST Object ID Update(ObjId); ('Touching' the record, fires triggers on Salesforce) Find SObjects on a custom object that have ...
5
votes
1answer
140 views

Access modifiers on sObject properties

Consider the following two classes. The first has simply a private Test__c and its constructor fills it in. The second class uses the first one and creates a Test__c object before instantiating the B ...
4
votes
1answer
565 views

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

I have a parent-child relationship with timesheets relating to users. I am trying to retrieve an Employment ID field from the parent record with SOQL and this is my query, where the UserID is a field ...
5
votes
3answers
434 views

Is it possible to check whether the record if modified or not from apex?

I have a scenario that need to check whether the record has been modified or not. If the record ir modified by any other user except user A. Need to show an error Message. Currently i have added a ...
2
votes
1answer
239 views

Cannot set value on checkbox using sObject via Partner API using Java

I get an error when I try to set a checkbox with the Salesforce Partner API. I have tried different combinations, but I get the error that an Object is required. Confirmed__c is a checkbox and this ...
6
votes
2answers
817 views

Generic SObject update pattern

Question I know that it is possible to update a generic of List<SObject>, But what is the best approach to generate that list without knowing the SObjectType, only the ids ? Sample: ...
12
votes
1answer
418 views

Proper method to get an Sobject instance from an Id

What is the "proper" way of getting an object from an Id? The method I use at the moment is SOQL, and that feels wrong..... Example: Account account = [SELECT Id FROM Account WHERE ...
2
votes
3answers
979 views

Invalid conversion from runtime type LIST<ANY> to MAP<String,ANY>

I'm trying to make a webcall to pull data from an external webservice. After that call I would like to insert my data that comes in the form of JSON into my custom object called Company. However I am ...