Questions tagged [sobject]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
35 views

retrieve other fields of a SObject after a user has selected an option

I am writing an app that will help calculate the statute of limitations for certain laws. ex. enter a date that a crime happened on and, after choosing a law and appropriate limitation the limitation ...
3 votes
1 answer
98 views

Change sObject field type and deploy using API

In this thread, there is a discussion about modifying a custom sObject's type. When I try to change the field's type in the Salesforce UI, I can see an error message with some references to the code. ...
1 vote
2 answers
763 views

Rendering Array of Custom Objects in Component

I have a custom visualforce component with a controller, it takes an attribute of an Id of a related record, and in the controller I query for the set of objects I want to display. When I attempt to ...
10 votes
2 answers
42k 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 ...
32 votes
2 answers
65k 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 ...
2 votes
1 answer
6k 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 Schema....
1 vote
3 answers
848 views

Didn't understand relationship error - Similar relationships, different behaviours

We have two objects which has lookups to Account object. Objects are as follows Issue (audit_breach__c) - R/S name Issues Audit (audit__c). - R/S name Audits Were trying to do the following SOQL on ...
0 votes
1 answer
220 views

How do I specify the sObject type when working with specific fields in a cast collection of sObjects

I had to transfer a bunch of records from one user to another today. I decided to use the dev console because I needed it done quickly. I wanted to write generic code using sObjects but couldn't work ...
6 votes
2 answers
15k views

What is the object that stores "files"

Which object stores the files (not attachments)? I'm looking to access this via a trigger. Is it possible to add a field to this document/file objects?
5 votes
4 answers
2k views

Why am I unable to pass an Opportunity from a Lightning Component into an @AuraEnabled Apex controller method?

I have a Lightning Component with an Opportunity attribute. The controller calls a helper method, which obtains the Opportunity from the component and attempts to pass it into Apex to be saved. I am ...
0 votes
1 answer
956 views

How to assign Sobject list into String

Hi I am having an Sobject list. While iterating through the Sobject list using FOR loop, I can only able to get the Id not all the fields of the Sobject. Can someone please help me to solve the issue. ...
3 votes
1 answer
539 views

How to use a Fieldset with an arbitrary sObject in Visualforce?

Working from the fieldsets section of the Visualforce Developer's Guide, I can build a table based on a fieldset for a given sObject type, for example (error handling elided for clarity): // ...
1 vote
2 answers
60 views

Many-to-Many schema design

We are soon to implement a solution where people (Person__c) can delegate jobs to other people, and which jobs depend upon a person's Role. (Role__c). The role of a person depends on the delegation ...
2 votes
1 answer
846 views

Salesforce Objects that do not have Id as the unique identifier

I just observed that a Salesforce Object called ApexPageInfo has duplicate Ids. The assumption was that Ids are unique. However, prodding through the describessObject of the object, the field ...
3 votes
2 answers
2k views

SOQL Query to get Accounts that have been refreshed since x time

I have a connected app that will pull data from a salesforce Object. In order to do so, am executing the following query (and sending it through the REST API as form-url-encoded): SELECT Name,Id,...
1 vote
2 answers
2k views

Dynamic Apex SObject Iteration

I've been trying for many hours to find the correct syntax in the documentation and via other searches in Google to get some dynamic code to run. Hopefully someone here will be able to provide the ...
3 votes
2 answers
6k views

List<SObject> Cast to List Concrete type

I have a List<sObject> scope and I want to cast it to a concrete type: List<My_Concrete_Type__c> I tried scope.getSobjects('My_Concrete_Type__c') but this doesn't compile. How can I get ...
9 votes
3 answers
9k views

Cast a Map <Id, sObject> to Map <Id, Opportunity>

I'm trying to implement the trigger framework outlined here: The triggerhandler methods take lists or maps of sObjects as their inputs. In his example he casts list <sObject> as list <...
0 votes
1 answer
3k views

Add to a cart : create and populate a custom object in apex

In a lightning component, I want that when I click a button, it create a new custom object (a virtual cart) and populate it with the select item. I have 3 custom object: the articles__c, the ...
4 votes
2 answers
64 views

Incorrectly Typed List - No Runtime Exception?

Grouping records is a pretty common pattern, enough so to write a simple library for it. Something like: public class GroupBy { public Map<Id, List<SObject>> ids(SObjectField field, ...
0 votes
1 answer
53 views

Trigger Calculation between two fields from different sObjects

I am new to apex. I have two objects blood_bank__c and patient__c. I want to change quantity of blood in blood bank after patient is given some blood. This trigger is not working, and its not allowing ...
2 votes
1 answer
161 views

Standard SObject which are not exposed by Salesforce

I would like to know if there is Standard SObject for Changeset or Package? I noticed that 033 is prefix for Package and 0A2 is key prefix for Changeset. However, neither of there objects are not ...
0 votes
2 answers
474 views

Unable to create copy Case owner look up field onto a custom lookup field

Is there any possibility to create the custom field like case owner of standard field.
11 votes
2 answers
777 views

Null record Date field displays todays date

I have a VF page where I am rendering out some subscription information and a couple of the fields are date fields. The issue (sort of) I am seeing is when a record is null and the VF markup calls a ...
6 votes
2 answers
1k 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 List<Object&...
1 vote
1 answer
2k views

How to find External ID of contact sobject?

I am looking into doing a web-to-lead integration with a Drupal website. As I understand it, to push data to a salesforce sobject I need to identify the relevant fields in Salesforce which are being ...
0 votes
1 answer
424 views

Deploying Entire Project getting "Cannot create workflow directly" Related to Reply and Question Sobjects

I'm using Sublime with Mavensmate to deploy an existing project to my SF dev org. Upon deploying I get the following errors. Reply.workflow: Cannot create workflow directly; must create the ...
8 votes
1 answer
1k views

"System.SObjectException: Contact.AccountId does not belong to SObject type Contact" error often in Summer '16

We are seeing a test failure in a couple of our Continuous Integration builds (that deploy the same code) with the error: System.SObjectException: Contact.AccountId does not belong to SObject ...
2 votes
2 answers
2k views

Sobject put set value of managed field in case of same field api name as unmanaged field

We are developing a managed package that contains a custom object and a REST API to do CRUD operation on that object. We are not using standard salesforce REST API for valid business reasons. In this ...
2 votes
1 answer
54 views

Trigger on Single Field

I was playing around with Apex Triggers and was wondering, suppose I had an object (for example Account), which contains a sub-object (such as the string BillingAddress). Can I set a trigger on ...
3 votes
0 answers
94 views

Does List<SObject>.sort method implementation depend on version?

I believe that I have found very interested undocumented bug in Salesforce. I don't see in the documentation saying that List.sort method implementation depends on version, but looks like it does. If ...
0 votes
1 answer
57 views

Updating records before insertion from a custom object into a standard object

I am working on a project in "Developer Edition" of salesforce ... I want to create such mechanism so that whenever I create a record in a standard object , it would check a certain criteria ( custom ...
2 votes
1 answer
3k views

How to check that SObject field is present in SOQL query

When you try to attempt to the field that not present in SOQL query, you get error like that: System.SObjectException: SObject row was retrieved via SOQL without querying the requested field: ...
10 votes
4 answers
3k views

Required Field on VisualForce Triggers "SObject row does not allow errors" message?

I must be missing something here..I have a visualforce page, that enables a user to create a Campaign - I have a pageblock/section with the Campaign Fields, including name, and Name is marked required....
2 votes
0 answers
911 views

How to size database columns for storing Salesforce fields; length or bytelength?

All fields in Salesforce have two lengths; a unicode character length and bytes length; our org uses UTF-8. We're sizing tables/columns in Oracle to accomodate our data from the cloud, my question is ...
4 votes
2 answers
6k views

Can someone please explain what is meant by sObject?

I am very new to the Apex programming first.And I know about Standard & Custom objects. And also the the custom objects have an extension of '__c'. I observed in the programming lot of reference ...
2 votes
2 answers
91 views

Embedded VF Page Not Responding To StandardController

I am trying to embed a custom VF page into my Accounts layout. I believe my error is in the standardController. I assumed it should be SObject but it did not work and now I am not 100% sure what it ...
0 votes
0 answers
37 views

insufficient previlage Error showing when insert record from modal(popup) Dynamicly

public SObject SobjectNewRecord{get; set;} public void newRecord(){ Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe(); Schema.SobjectType oType = gd.get(...
40 votes
1 answer
19k views

Infering sObject Type from Id or collection of Id's

If I have an instance of an Id variable that has been populated with a value, is there way to infer the sObject type of that Id using a describe call. So if I did: Set<id> parentIds = new ...
2 votes
3 answers
197 views

Invalid field for SObject using nested SOQL Query

Trying to create a list of Open activities so that I can sort and display as an apexDataTable on a VF page. I'm currently seeing the error: Invalid field Subject for SObject Account VF Page ...
0 votes
1 answer
333 views

Not able to undelete Attachments

I have written a trigger on Attachment. Events are after insert, update, delete and undelete. But I noticed that the undelete trigger doesn't fire at all. I tried to undelete from recycle bin. Even ...
0 votes
1 answer
74 views

Compile Error: Initial term of field expression must be a concrete SObject: String

this is checkbox S1SD1__c public static void moveStageBackward(Opportunity opp, Opportunity oldOpp, String newStage, String oldStage){ Map<String, Schema.SObjectField> objectFieldMap = ...
2 votes
1 answer
4k views

Passing Sobject to apex rest method using JSON

I am exploring a way to pass a sobject to an apex class. Below is my apex class: @RestResource(urlMapping = '/resturl/*') global with sharing class check { public boolean Hide { get; ...
1 vote
0 answers
228 views

How to create relation between a custom object and Products Line Item ? (Same as Quotes & Quote Line Item)

I was looking for a clean approach where I can apply multiple Products' to a Proposal(Estimate). Would need to be able to add an unknown number of Products to the Proposal(Estimate), along with ...
1 vote
1 answer
26 views

Quote Trigger Initial term of field expression must be a concrete SObject: Boolean at line 32 column 89

I can't seem to figure my issue here on the code below. Originally I had Opportunity__c and was getting a invalid field error. I replaced Opportunity__c with the OpportunityId field and received the ...
4 votes
1 answer
1k views

How to see the entire resultset in the debug log instead of (n more)?

Good Morning, Thanks in advance for reading. Is there any way to display the whole sObject in the resultset returned by SOQL query instead of the (n more) below e.g. 30 more, 22 more etc. ? I am ...
0 votes
0 answers
310 views

External id field is not populating when cloning a sobject record

I have used object.clone() here and then changed some field values. All the changes are reflected in the cloned record except not able to populate External Id field which is concatenation of two Id ...
0 votes
2 answers
409 views

Overwrite an SObject with another SObject without losing related records

In Apex is there an efficient way to overwrite an SObject instance with another SObject (both of the same type) without losing parent and children records? In the following example I want to replace ...
4 votes
2 answers
1k 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=}, Account:{AccountNumber=}...
1 vote
1 answer
793 views

Get fields from custom object

I have a string which is a name of sObject. I converted the string to a sObject. Now I want to get the fields from the object. When I try to access the fields from sobject (contact) i am getting error ...

1
7 8
9
10 11
13