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

1
vote
3answers
29 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
16 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
15 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
83 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
25 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
99 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
37 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; ...
0
votes
2answers
53 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
34 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
109 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 ...
2
votes
4answers
98 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
23 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
24 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
91 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
245 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
498 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
77 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
66 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
138 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 ...
6
votes
2answers
2k 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
101 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?
1
vote
1answer
299 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 ...
1
vote
1answer
142 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
161 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
87 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
82 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
131 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
147 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
249 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
173 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
121 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
371 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
254 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
161 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
439 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
334 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 ...
1
vote
3answers
705 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 ...
12
votes
1answer
829 views

Generic Apex Trigger

So I was kind of throwing round the idea of making a generic apex trigger that is callable by multiple objects. Say you have the following sObjects: Account Sales__c Sales_Contacts__c And I wanted ...
2
votes
2answers
93 views

Is there an object browser for the built-in or custom objects?

Being a noob, it's difficult to get my head wrapped around the vastness of the salesforce expanse. In Visual Studio and other environments like the standard Java Eclipse, they typically have an ...
0
votes
1answer
879 views

“New Action” vs “New Button or Link” for a custom object

A custom object's setup page has a section "Buttons, Links, and Actions". I've created buttons and links in the past, but do not remember the "action" option being there. Can anyone explain what ...
0
votes
1answer
109 views

Accessing Sobject using javascript

I want to access a Sobject field using javascript in a visual force page and based on its value perform an action. How can I access a Sobject field using javascript?
1
vote
0answers
342 views

Trying to determine fields I want to set dynamically rather than hardcode - very close / not possible

I am messing around with the dynamic nature of Salesforce. I want to clone Opportunity into a custom object. It's a very easy requirement in itself. What I am trying to do is make if completely ...
1
vote
1answer
2k views

Getting an initial term of field expression must be a concrete SObject error:

I'm getting the following error: Save error: Initial term of field expression must be a concrete SObject: LIST Force.com save problem Here are the snippets of code in question: List ...
4
votes
1answer
174 views

Error when I populate lookup with external id using .put method

You can populate lookup fields using an object with an external id field populated like so: Custom_Object__c o = new Custom_Object__c(Account__r=new Account(External_ID__c='123')); insert o; ...
10
votes
1answer
2k views

Error: MIXED_DML_OPERATION on setup and non-setup objects

In my test class i have the creation of a dummy custom setting and a dummy lead: Group g1 = new Group(Name='group name', type='Queue'); insert g1; QueuesObject q1 = new ...
3
votes
2answers
82 views

Why (referenceTos[0] != null) check is being performed in following code?

I was going through a salesforce.com developer documentation code // Iterate through the list of describe sObject results for (int i=0;i < describeSObjectResults.length; i++) { ...
5
votes
1answer
267 views

Adding an error on a dynamic referenced field

Is there a way to add an error on a dynamically referenced field? Let's take this simple example: opp.get('Name').addError('Invalid name'); This is not working, I'm looking for a similar minded ...
1
vote
1answer
99 views

How to give an object's all fields visibility to all profiles

I have an object which has around 100 fields now need to give all fields visibility to all the profiles. One possible solution is to edit each field and give its visibility to all profile but if i ...
5
votes
3answers
1k views

Serialize Class to JSON with correct sObject API field names

I want to use the standard Force.com REST API to create a case remotely from another Salesforce instance in my instance. I want to populate two fields on creation: "Subject" and "txt_UserId__c". ...
2
votes
2answers
184 views

Determine sobject Type From Id Using SOAP API

I'm using C# and would like to determine the type of an sObject based on it's id. I would like to pass an id to my app and have it return a list of accounts related to it. I need to identify the ...