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

Convert JSONParser to SObject

I'm trying to convert a JSON file, which has information from one or more objects. I saw that one way was to transform the JSON String to JSONParser and loop to generate the objects. I want to ...
7 votes
2 answers
15k 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 ...
10 votes
2 answers
1k views

Does the `getSObjects` method on `SObject` work with Person Account child relationships?

Our app uses a lot of dynamic SOQL, and in a client org I'm currently getting an error which I can't explain when we're performing a large query against account, including subqueries for all related ...
0 votes
0 answers
320 views

Where are case comments located?

I am looking for the case comments object within Workbench, but I am unable to find where the replies are being stored. I found the main parent comment located within CommentFeed, and it also shows ...
1 vote
0 answers
423 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 non-...
2 votes
1 answer
2k views

INVALID_TYPE: sObject type 'InstalledSubscriberPackage' is not supported

I'm querying the tooling API via some external C# code to get a list of installed packages. SELECT SubscriberPackage.Name, SubscriberPackage.NamespacePrefix, SubscriberPackageVersionId FROM ...
0 votes
3 answers
441 views

How to assign a value to an Account sObject

I am trying to create an Account sObject so that I can reference at my later code. For the purpose I am running a query on Contacts, and then I pick fields from it and assign them to my Account ...
2 votes
1 answer
1k views

sObject type 'MetadataComponentDependency' is not supported

If I understand correctly MetadataComponentDependency supports standard and custom fields on standard objects, but neither on custom objects. Will it eventually support standard and custom fields on ...
1 vote
2 answers
738 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
0 answers
151 views

Alternative to Delete Trigger for tracking deleted records in OpportunityShare Object

We want to track the deleted records in OpportunityShare Object for some reason. This object doesn't support to write a trigger. Is there way to track those deleted records?. Any suggestion would ...
1 vote
2 answers
1k views

Naming convention [duplicate]

What is the best naming convention developers around have been using for defining Record names to maintain uniqueness that can also be searched easily : foreg: opportunity name : Opportunity ...
0 votes
1 answer
215 views

How to get hierarchy of all objects dynamically through schema code

How to get a hierarchy of all objects dynamically through schema code in Salesforce I have code like below. Set<String> strForRelatedObjects = new Set<String>(); Schema.SObjectType ...
0 votes
3 answers
2k views

Field is not writeable: User.UserType

I'm trying to test a scheduled Apex class and I have a method that generates fakes users within my test class: List<User> newUsers = new List<User>(); Profile p = [ SELECT Id FROM ...
0 votes
1 answer
253 views

Individual Object Installation

Our org wants to implement the Individual object in our SFDC to comply with GDPR. Problem: We want to flag 'individuals' who chose to be forgotten with the 'shouldForget' field as a flag. ...
-1 votes
1 answer
68 views

Queried column disappears from results

I just added a new field to a custom Salesforce Object. I now want to query that field from the database. If I query it from the developer console, everything is fine. However... If I query it from ...
0 votes
2 answers
265 views

Object Relationship Tree

I am currently trying to figure out how to elicit an object relationship tree from Salesforce, so I can export test data to use in my Scratch-Orgs. Basically what I want to do is poll to produce a ...
-1 votes
1 answer
92 views

Unable to access values from the old map

Currently, I'm trying to get values from an old map because currently, my map is like Map <Id, Sobject> It's showing an error like Variable does not exist: ARPU__C I'm unable to fetch data ...
0 votes
1 answer
72 views

unable to set value of recordId for navigateToSObject where value is coming form aura:iteration

I am new to Lightning component I have created a simple app for my sand box. i which i am trying to access my record home page in the first step I have created simple list of task in which I have got ...
4 votes
0 answers
1k views

How do Domain Driven Design principles apply to Salesforce development? (was: Is abstracting away SObject model a good practice for Apex Controllers?)

Domain-Driven-Design principles are largely adopted in companies embracing microservice architecture and one of the key ideas is to separate the data model of the persistence layer from the business ...
0 votes
1 answer
590 views

Sobject for contact and leads

I need help converting this method's parameter into an sobject, so it can accept two different types of objects So currently the method is returning a lead activity record, but I want it to return a ...
2 votes
1 answer
2k views

Limitation on using getPopulatedFieldsAsMap method

I am excited to getPopulatedFieldsAsMap that being released on Summer 16 . I tried to run query however some of field does not return value. I thought it was bug but somehow it should be fixed in ...
1 vote
0 answers
25 views

How to truncate CampaignInfluence

CampaignInfluence is consuming a large amount of storage as you can see. Now I've tried to access the object through Workbench etc but no luck. Anyone managed to access the object and do some cleaning ...
8 votes
1 answer
10k views

Find out the default record type of any Object in Apex

I've to find out the default record type of an Object so that I can use in Apex to insert/update records. Found out that it is at the user level(user profile based). Is there any other way which I ...
4 votes
0 answers
199 views

How to query the Lightning Sync Error records

Once Lightning Sync is enabled a new report type can be created, selecting LightningSyncError as the primary object. I would need to query this object in order to get the list of sync errors through ...
0 votes
2 answers
887 views

How to pass dynamic object into for loop

I have a standard controller from which I get the object. How can I use this in a for loop? Apex ... public ListToStringContact(ApexPages.StandardSetController controller) { setCon = ...
1 vote
1 answer
207 views

SObject List vs Map instanceof subtype

Map<Id, SObject> sObjectMap = new Map<Id, SObject> (); System.debug(sObjectMap instanceof Map<Id, Account>); // false System.debug(sObjectMap.values() instanceof List<Account>);...
1 vote
1 answer
617 views

How to add formula field to SObject instance using apex

I need to a add formula field to SObject in Apex before the record is persisted. Sobject.put(formulaFieldName, null) returns the error that the field is not editable. I would need to run SObject....
1 vote
3 answers
750 views

'json Not a Valid Enumeration for type' Error When Retrieving Standard sObjects with IntelliJ/Jetforcer

I use IntelliJ with Jetforcer for Salesforce development. Starting yesterday, I began receiving the following error when trying to retrieve Standard sObjects for my project: jsonNot a valid ...
25 votes
3 answers
1k 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
1 answer
336 views

user merge fields doesn't replace by user record ID

I am trying to send email through email template to user but It is always replacing the user merge fields by org admin's user name instead of targetobjectID user. Org admin : luke wright Email ...
3 votes
2 answers
165 views

What happens when I edit an sobject in a Set?

When I change an object in a set to match the other object in the set do they now merge? When I have a set of 5 sobjects, and they are all unique objects (unique Signatures) I add them to a Set, ...
0 votes
1 answer
727 views

Error when trying to send post request via python /composite/sobjects

Pretty much title says all, I was able to get the snippet within test = {} to work within salesforce workbench. Would love some guidance on what I am doing wrong as individual "non-bulk" requests work....
0 votes
1 answer
3k views

How to deserialize JSON to sObject?

I have following code and I'm trying to deserialize json array to list of sObjects, but I'm getting following exception without any message: System.JSONException: String dzejson = '[{"attributes":{...
0 votes
1 answer
295 views

Overwrite a related list for an sObject inside a Map without looping?

Question: Salesforce allows me to write specific field values to specific related list records on an object in a Map by referencing the __r[Index] relationship of that particular record. However, it ...
0 votes
2 answers
945 views

Which object should be used in storing files?

The Attachment object looks like the correct choice if you have a file you want to relate to only one record. ContentDocument with ContentDocumentLink looks good if you have a single file you want to ...
2 votes
1 answer
3k views

Retrieve SObject using Schema SObjectType class

I am trying to create a dynamic class to retrieve a record for update. I struggle with the following part of the code: targetSObject = new sor.getSObjectType()(ID = sObjectID); For example, if this ...
0 votes
1 answer
2k views

Get Field value from object using string key

I am trying to do get values from the object using string key, I have typecast the Contact object into the object but not getting value. Please help how to get value from the object using string API ...
3 votes
2 answers
3k views

Benefits of using sObject.clone versus creating a new record

Hello I am curious whats the use case of the clone method. Also when its beneficial. Example here I create a lead once then clone it 200 times. list<lead> leadlist = new list<lead>(); ...
2 votes
1 answer
151 views

Update sObjects in .sfdx/typings

I have a VSCode SFDX Project that we use to develop LWCs, and we recently changed some object names in the Org and now I can't upload anything to our Org. I found that there is a command to refresh ...
0 votes
0 answers
89 views

How to store a collection type (set, map, list) on a object?

I have a visual-force page which displays an Apex form with some dynamic number of input text fields that I would like to save on the Opportunity object. Is the easiest way to serialize them as JSON ...
1 vote
1 answer
746 views

How to enable read permissions for organization sobject?

I'm trying to use the salesforce standard rest api to access the organization sobject so I can read the name of an organization I'm working with. I make a soql query "SELECT Id,Name FROM Organization ...
3 votes
1 answer
1k views

Rendering Visual Force page as PDF via the REST api

The documentation suggests that a Visual Force page can easily be rendered with apex: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_output_pdf_render_in_apex.htm // ...
1 vote
1 answer
101 views

unable to read sobject when object has id null

I am actually getting the error "Unable to read sobjet", when sending an object to my server even if I specify the sobjectType as follow : sendforSave : function(component) { var habitatInfo = ...
-1 votes
1 answer
26 views

How salesforce compares on sObject with another

We know that "Set" is a collection of unique records. If I am creating a set of SObjects, on what basis Salesforce identifies Uniqueness of the entries in the Set?
1 vote
2 answers
155 views

How do i iterate over a list with 3 different object types in lightning component?

I am building a lighting component which needs to iterate over a list with three different object types but I have run into a problem because I cannot write an aura if expression which checks the ...
1 vote
1 answer
952 views

How to access Owner field using getDescribe().fields.getMap()

I have a below code to access owner field from sObject. Map <String, Schema.SObjectType > sObjects = Schema.getGlobalDescribe(); Schema.SObjectType targetType = sObjects.get('...
14 votes
2 answers
14k 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: List<...
-4 votes
3 answers
542 views

how to create dynamic query [closed]

List<Opportunity> opps = [ SELECT Id ,Name ,Amount ,CloseDate ,Stagename ,Near_to_Close_Date__c ...
0 votes
2 answers
857 views

Convert List<String> into List<Schema.SObjectField>

I have a below code public PageReference SyncCandidatewithMirror(map<Id, cxsrec__cxsCandidate__c> NewMap,Map<Id, List<String>> fieldChangedMapChanged, List<...
0 votes
1 answer
61 views

How does joining two custom objects into one custom object through master-detail relationship work

I've been working on a test method but I've had a problem creating the setup of it. public static List<Job_Posting__c> createPostings(){ List<Job_Posting__c> testPostings = new ...

1
3 4
5
6 7
13