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
2answers
33 views

Getting null value from standard getter method of sObject

I am stuck in a very strange situation. I have one custom object (test_Boolean__c) and a field of checkbox type (check_Boolean__c) whose default value is true. Now this is what I did :- Created a ...
0
votes
1answer
19 views

Update a record to its default values[MetaData]

I want to refresh a record to the default values that we used while creating those fields ie in metadata. My object has around 100 fields, so manually searching and doing it is troublesome. I can use ...
0
votes
1answer
23 views

Incompatible value type id for Map error

Anyone know why this keeps throwing an error? list<Account>Dealerships = new list<Account>(); map<Id, OpportunityLineItem> Opp2Deal = new map<Id, OpportunityLineItem>(); ...
4
votes
2answers
35 views

Utility Method Returning Different Type (Set instead of List)

Previously I had posted this question awhile back: Utility Methods flexible enough for all sObject Types Now I want to expand my method a bit to return a Set<Object> instead of a ...
0
votes
1answer
27 views

How to query another Objects field to get it's value

How do I query the value of Contact.Country__c? It is to be connected with Case. For now my code is: @isTest public class WebToCaseCountryTest { public static testMethod void testTrigger() ...
1
vote
0answers
19 views

How to clone record with its related list using custom clone list button in Sobject?

Clone record with its related list and update the picklist value i have created one button on record top beside the clone button, when clicked, execute code that would make a new version record with ...
0
votes
2answers
14 views

Using getSobject to fetch the parent Account of an Account

I would like to dynamically fetch the parent Account of an Account in a similar fashion to the way it's done in the selected answer to this question. However, this doesn't seem to work in this case. ...
1
vote
1answer
40 views

How to compare two sObjects from 2 List<Lead>()?

I'm in need of a way to see if changes were made to a reference of an object, and compare to the original values. This is independent of the trigger context variables such as oldMap + newMap. Is ...
0
votes
1answer
33 views

How to render a value to string which is coming from sObjcet Long Text area in saleforce Apex Class [closed]

I have a sObject which has a Long Text Area field "Account_Id" which contains , "'Account Name'+Account.name" but when i want to replace "Account.name" value from my Apex class than i am failed. e.g. ...
1
vote
1answer
34 views

List has No Rows for Assignment to SObject: Error

I have below trigger code where I get "List has No Rows for Assignment to SObject" Apex trigger: trigger CallVisibility on Compliance_Incident_Transaction_abv__c(before insert, before update) { ...
3
votes
0answers
31 views

Change sObject field type and deploy with API

in this thread, there is a discussion about modifying custom sObject's type. When I try to change the field's type in Salesforce GUI, indeed I can see the error message about some references in code. ...
1
vote
1answer
36 views

Javascript query not finding existing field

There is some small work going on with a custom javascript button in an org that I do not have Admin access to. It fails on a field that clearly exists. ...
0
votes
1answer
84 views

Dynamic SOQL for getting all objects in Salesforce Org

I am creating a VF page which contains a Picklist of all objects in my Salesforce org including Custom Objects. I am getting an error 'unexpected token: 'null' when I select custom object. VF Page ...
1
vote
1answer
26 views

Attach Files to sObjects that don't offer standard support for it

I'd like to give users the ability to attach files to the Opportunity Product sObject which doesn't inherently support file attachments. How do I add that ability?
3
votes
1answer
77 views

How to use addError() with a dynamically derived field name? [duplicate]

I know I can add an error to a field as follows: Account someAccount = [select id, name from Account limit 1]; someAccount.name.addError('Bad Name'); How can I do that if the field name is only ...
1
vote
1answer
64 views

Getting field value dynamically while using describefieldresult

What I have to do is to get all fields of an sObject and converting it into xml runtime. I have all the fields. And I get field name and field label in xml tag. What I want is field value instead of ...
2
votes
2answers
76 views

Enterprise WSDL maps objects to different types in different organizations

I have two organizations, one for development and another for production/sandbox. When I generate an enterprise WSDL from production/sandbox I have some lookup relationships mapped as Name. When I ...
1
vote
3answers
187 views

Is it possible to retrieve picklist values from SalesForce using SOQL?

I am using a .NET library - SalesforceMagic - for communication with SalesForce. I use a SalesForce API user credentials and pass data to and from via a SOQL query. It all works fine. Now, there are ...
1
vote
4answers
55 views

error while trying to upsert a list of Sobjects

I am trying to perform the following procedure: String tipoInt = 'Account'; List<SObject> sl = new List<SObject>(); Sobject so = Schema.getGlobalDescribe().get(tipoInt).newSObject(); ...
0
votes
1answer
15 views

Get info if sObject is 'setup' object from metadata

I need to know if some sObject is setup object during runtime from apex code. Does anybody know how to do it? I checked the documentation on sObject class and didn't find it.
1
vote
1answer
83 views

Visualforce page usingbase standard controller

I have the following Visualforce page and controller: <apex:page standardController="sObject" extensions="ExtensionController"> <div> {!o.Id} </div> ...
0
votes
0answers
64 views

Create Public custom settings via REST API

First, is it possible to create a custom object without using Metadata SOAP API ? As per my reading until now it is not possible. I know for a fact, one can create ApexTrigger using REST API. Since I ...
0
votes
0answers
24 views

Apex:Detail return url incorrect after rerender

I have a simple page with an Apex:Detail on it and a list objects shown using a picklist on the page. As i change the picklist values, the apex:detail is rerendered to display the detail page of the ...
0
votes
0answers
17 views

How to figure out if a ContentDocument has been shared/Unshared?

I want to figure out when a ContentDocument has been shared or unshared with some user/group which is internal/external to the enterprise.. I see that an sobject by the name ContentDocumentLink is ...
7
votes
4answers
223 views

Best Approach/Way to Query Single SObject record

To query a single record we have below two approach : Approach 1. Assign record to a single Account variable as shown below: Account accountToGet = [SELECT Name From Account where name = ...
5
votes
2answers
52 views

Codes and Values

We have clients that use a lot of codes in their day to day activity. Eg: Take a look at the UK Government Common Basic Dataset: ...
1
vote
0answers
14 views

Tracking changes to object structures through SOAP API

I am looking to check whether the object that I queried has changed during the previous access. For example, if a new field was added to the Account field, I would like to alert the user that a new ...
1
vote
1answer
46 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
41 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 ...
14
votes
3answers
264 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
371 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
101 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
230 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
65 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 ...
7
votes
2answers
246 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
284 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 ...
3
votes
1answer
326 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
61 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
35 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
75 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 ...
4
votes
2answers
1k 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
1k 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
40 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
168 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
136 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 ...
3
votes
3answers
387 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
332 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
37 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
705 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
187 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 ...