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
1answer
26 views

LoginType field shows length 1 but retrieves length greater than 1

I am trying to query AuthSession object where the loginType field shows the length 1 but the length is actually greater than 1. Sample: Id ID 18 UsersId ID 18 CreatedDate dateTime 0 LastModifiedDate ...
1
vote
0answers
24 views

Error while parsing object Contract received through Metadata API caused by restrictedPicklist

I retrieve SObjects using retrieve() call from Metadata API and then I'm trying to parse them like described here in comment. The problem occurs while trying to parse standard object Contract. It ...
13
votes
2answers
164 views

What is a use case where one would use an SObject as a Map key?

In Dan Appleman's book Advanced Apex Programming, he explains how using SObjects as Map keys (i.e. Map<SObject, *value*>) is supported but it's poor practice, since the key is actually ...
0
votes
2answers
38 views

How to get ID prefix if you know the object name

I find an object I need in Setup => Create => Objects. I want to get a list of this objects or create a new one. I know, that if I have an existing object, I take first three chars and I'm fine. ...
8
votes
1answer
68 views

Name field of Group sObject is Not Nillable but returns null

I request the metadata for the sObject Group via: GET /services/data/v32.0/sobjects/Group/describe/ HTTP/1.1 In the resulting JSON i see the following metadata at the fields property: { ... ...
1
vote
3answers
74 views

How to get SObject type from object Id using REST API?

I have an object id that is a "parent id" of a specific Attachment object (e.g., b3KD0000119wDTlMAN). I'd like to understand what type this object belongs to, to query for it's details. It can also be ...
1
vote
2answers
24 views

Show reports from a report folder in picklist

I currently have a text field on a custom object which is supposed to store a report URL. As things are right now, the user can simply paste the URL of a report and it gets saved. However, I want ...
6
votes
2answers
98 views

What are the advantages of Light Application objects

I was hoping that the introduction of "Light Application object" would do something about the data storage of junction objects, but it doesn't seem to do anything about it. The documentation seems ...
1
vote
3answers
184 views

1:1 relationship

What is the best way to create 1:1 relationship in Force.com. I have an Object A. What i need to create is another object B, which will be like an extension to this object. Since there are already ...
2
votes
1answer
90 views

Apex JSON.serialize() with null values (RELOADED)

I need to serialize a list of SObject without omission null values. This string I need for a later usage in JavaScript. Structure is crucial, because I need to construct a table out of it. The ...
0
votes
2answers
36 views

Using inputField to set SObject list item in Controller

So I've been working on this project on and off for quite a while and have finally hit a crossroads. I have a custom controller and visualforce page I wrote to act as an input form. The form is ...
0
votes
1answer
27 views

Check the field of a related record

I need to fire a Trigger when an Opportunity record is updated and Stage = Closed Won and there is a specific value in the name of the related Opportunity Product. What's the syntax for this IF ...
1
vote
1answer
47 views

Formula Field from REST Service

So here is an odd question. On our Opportunity object we have a formula field. Is there anyway to pull in the actual formula calculation through any API, APEX, REST, SOAP? I have an iOS app and a ...
2
votes
1answer
332 views

Apex Cast sObject list dynamically to a specific sObject Type

The upsert() DML operation requires a specific List based on a specific sObject type, for instance:List<Account> lstAccount = new List<Account>(); However, we are trying to generate a ...
8
votes
3answers
251 views

Utility Methods flexible enough for all sObject Types

QUESTION I am trying to create a few utility methods that can work with any sObject that gets passed to it and return dynamic data-types. Unfortunately I'm starting to wonder, is this even possible? ...
1
vote
2answers
21 views

Add canvas app to layout of all object

How can we add connected canvas app to layout of all the objects like account, opportunity, custom objects etc. Currently I have to go to each object, edit layout and add canvas app. Also, If ...
0
votes
1answer
68 views

How to compare a text value in a list of sobjects?

The following gives me a list of texts which are customer numbers (CUST_NUM__c) List<SYSTEMS__c> lst_PartnersAcc = [SELECT CUST_NUM__c FROM ...
0
votes
1answer
70 views

How can i convert sobject to xml using php soapclient?

I am using php soapclient to fetch data from Salesforce. I get a sObject back. I need to do field mapping, hence I need to convert this result into xml so that I can have a xslt to convert this data ...
2
votes
2answers
143 views

Is it possible to Upsert a List<SObject> with external ID specified

I'm getting an error when attempting to compile my Apex: Upsert requires a concrete SObject type In my code, I'm unable to create a concrete declaration for the container which I want to upsert. ...
3
votes
1answer
155 views

how to get all fields from any object and its parent object in apex?

I have tried this code but i am only getting particular object fields but not its parent fields. any suggestions what i am missing? public with sharing class FilterCriteriaComponentcontroller { ...
3
votes
1answer
31 views

Are SObjectField tokens safe in cross-managed package calls?

We have some code and SObjects and fields in a managed package that works when executed by other calls in that managed package as your would expect. The code looks like this. private SObjectField ...
0
votes
4answers
158 views

Get value of LookUp field through query

I am having a problem with a query. I am trying to extract the name of Assigned_To__c field (which is a look up field of Employee Rosters object). The query I have used for this is SELECT id, ...
2
votes
1answer
113 views

Nested map without SObject

I'm using a nested map to store inputs from a Visualforce page and when I try to write the code to retrieve those inputs, I am getting "Error: Compile Error: Initial term of field expression must be a ...
0
votes
2answers
25 views

For loop issue in class

I have to get IDs of Call custom object from Incident Transaction custom object and run a for loop on call feeding the list. Can someone help me here? List<SObject> myCalls = [SELECT ...
0
votes
0answers
22 views

Set sObject in component and update in master page

I have a problem, struggling from few hours and feeling lost right now. I have a custom component (AddressComponent.component) with it's own controller (AddressComponentController.cls). The component ...
1
vote
2answers
129 views

Want to restrict a user from creating more than 10 records w/o RSF

I have a object where 1 user can only create 10 record not more that that. If I don't want to code (by count() we can achieve it) but is there any other way that we can count the number of records no ...
0
votes
1answer
58 views

List all fields of query with subquery

I have this query: List<sobject> query_result = Database.query(query); with query = SELECT Email,Fax,(SELECT Status,Type FROM Cases),(SELECT CreatedDate FROM Tasks)FROM Contact WHERE Id = How ...
-2
votes
1answer
70 views

I just want to display the values in picklist on VF Page

String soql = 'Select '+ pickField +' From '+ pickobjects; list<SObject> sObj = new list<SObject>(); sObj = Database.Query(soql); now i want to put the values of the list sObj into a ...
2
votes
0answers
26 views

Implementing WorkBadge History for Apex/VisualForce

What I would like to accomplish is create a visual force/apex page that show's how many times someone has received a specific work badge on salesforce, such as the "Thank You" badge. It's similar to ...
0
votes
0answers
130 views

Problem passing Account object from VF page to Flow sObject Variable

I have a problem passing an Account object from a visualforce page to an sObject variable in a flow. Error: When I go to the url: ...
0
votes
2answers
79 views

building an sObject from a json string in VF page

How can I deserialize a JSON string into an sObject in a VF page? I don't want to use a controller so I'm looking for the right approach to do this on the client side only. Any ideas?
0
votes
1answer
33 views

Custom object schema visibility

We are planning a managed application for Salesforce platform and there are few things that are hazy. Lets say if a customer install our managed application in their organization will they be able ...
2
votes
1answer
43 views

How to create object by it's name?

I'm writing a REST service which calls external service. I want to write a test for my service. I came up with no possibility to mock this call as it's in managed package. I want to wrap this call ...
1
vote
2answers
93 views

How to get to which object the field has reference

I have a wrapper class which contain some Object name. Now I am looping through a base object and want to check is the base object have lookup to any of these object. But when I pick the describe of a ...
0
votes
2answers
156 views

How to find the relationship between objects in apex class

Hi I have a base object that is a main object and I do have some other objects which is coming dynamically. I need to find out the relationship between the objects in apex class. If there any way to ...
2
votes
1answer
75 views

How can I get all the object and fields from the org which are accessible to the login user only.

I am getting all the object and related fields from my org using public Map schemaMap = Schema.getGlobalDescribe(); Map fieldMap = schemaMap.get(objectName).getDescribe().fields.getMap(); ...
0
votes
1answer
299 views

Error: Read access denied for null

Does any one have any idea why I am getting this error when I try to save {!sobj.c} Error: Read access denied for null my code <apex:repeat value="{!wcls}" ...
3
votes
1answer
82 views

how to loop through a list of sObject and field on VF page

I have a list of sObject which get populated dynamically all the objects and the related fields. The list look like this on debug (Contact:{OtherCountry=, Division_Type__c=}, ...
1
vote
1answer
537 views

How to display a list of dynamic sObject on Visualforce page

I have a list of sObject which I have created dynamically. This is how the list is populated. (Contact:{OtherCountry=null, Division_Type__c=null}, Account:{AccountNumber=null}) I don't want to ...
0
votes
1answer
232 views

How to add fields dynamically to sObject

I have a map which contain sObject anf sObjectfields. Now am looping through the map and want to add the fields to the list for eg: account.Name, conatct.Name, contact.type__c. And after that need ...
1
vote
1answer
333 views

Get SObject from Schema.SObjectType

I am getting all objects and fields now I need to add the object and field to a map where map is public List sObjectFieldLst = new List(); How can add the values to the map from ...
0
votes
1answer
145 views

How to covert a string to sObjectType

I have a object A where I am saving the name of the object as Strings and the fields also as String. Eg: If I have object Account, contact and opp objects. I am saving object Account as object Name ...
3
votes
1answer
128 views

How to get the information of a user who deleted an object?

Salesforce REST API supports the getdeleted endpoints to furnish a list of deleted records for an SObject. The response from the API looks like this { "deletedRecords" : [ { "id" : ...
3
votes
1answer
201 views

How to get recentlyviewed objects for all users?

Salesforce REST APIs support endpoints for getting updated, deleted and recentlyviewed objects. I am interested in getting the recentlyviewed items. This endpoint returns data of the form { ...
0
votes
0answers
103 views

SObject deployment: Cannot specify a startsWith attribute for this language

I'm trying to deploy an sobject to a new empty environment. I get the following error: Cannot specify a startsWith attribute for this language Both orgs are in English. Any thoughts? Edit: The ...
14
votes
4answers
2k 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.
3
votes
1answer
464 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
435 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
227 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
49 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 ...