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

10
votes
4answers
404 views

Howto wildcard SELECT * to query all fields of objects in APEX?

I have created sObject and I need all the fields and I have many. Is there a way I can directly get all of them rather then typing each one of them.
2
votes
1answer
28 views

Compile Error: sObject type 'Custom__c' is not supported in Managed Package

I'm creating an apex class that implements Schedulable and in the execute it queries a Custom Object but I can't understand why I'm getting this error when trying to query. Some other related ...
0
votes
1answer
26 views

convert string to sObjectfield type

I have a custom setting where I have fields api name and getting the field api name and use with sObject. At that time I am getting error cannot use string with the sObject. How can I convert the ...
1
vote
3answers
73 views

Pass result of SOQL query into a variable

I have the following query: public List<My_Main_Object__c> data; data = [Select My_Object__r.Id FROM My_Main_Object__c where id=:XXXX]; How can I pass the result of this query into a ...
1
vote
2answers
38 views

How to prevent refreshes from blowing out sobjects and tables

I have created an sobject the essentially manages a callback URL to app servers we have running in-house: http://devmyapp01.example.com http://qamyapp01.example.com http://myapp01.example.com ...
0
votes
1answer
18 views

Cross-objects workflow with scenario

Can any body here explain me what is cross object workflow and how can we use it, what is the scenario where we can apply this.
1
vote
1answer
94 views

Insert multiple SObject data in Salesforce as single transaction using REST calls

I am using following soObject call to insert new row in the Account table at Salesforce server : curl -H "Authorization:OAuth use your session_id" -H "Content-Type: application/json" -d @Test.json ...
2
votes
1answer
13 views

getting layout of user using API

I am using this link to get the layout. I am using a REST client, Here is my request https://ap1.salesforce.com/services/data/v28.0/sobjects/Global/describe/layouts/ Authorization: Bearer ...
3
votes
1answer
37 views

problem with sObject as parameter

I get the below error when I try saving CLASS 1 below. The second class that is the problem is also below. I obviously don't understand objects or apex well, so any help would be greatly appreciated. ...
5
votes
2answers
100 views

SObject constructor signature?

when instantiating an SObject type, I can set initial field values by passing them to the constructor. For example like this: Account a = new Account(name = 'Acme', billingcity = 'San Francisco'); ...
0
votes
1answer
35 views

Illegal assignment from list<event> to sobject. Please help me in modifying the code

I'm writing a trigger to update the activity field-contact_sys_id__C with the value of sys id /siebel id depending on the if type field. trigger ContactSysID on Event (before insert) { ID evid; ...
3
votes
1answer
70 views

Get SObject by Id

I have an Id and I want to know if it's possible to get the SObject with this unique ID ? Something like : SObject object = getSObjectById(myId); I didn't find a method allowing that !
3
votes
1answer
79 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
140 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
118 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
39 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
38 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
51 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
316 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
90 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
38 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
50 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
87 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
880 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
43 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
58 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
33 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
748 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
31 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
159 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
50 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
212 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
58 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
1k 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
270 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
29 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
193 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
1k 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
2k 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
237 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
222 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
386 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
5k 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
109 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?
3
votes
1answer
2k 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
629 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 ...
5
votes
1answer
354 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
153 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 ...