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.
634
questions
0
votes
0
answers
26
views
Join User and LoginHistory results into a single table list or map
The objects User and LoginHistory have no relation although both have a property for user id. I want to join / merge the result of two queries
all active users: SharingCriteria__c, Project__c, Id, ...
0
votes
0
answers
37
views
How to retrieve a list sobject name that only contains Standard and Custom Objects when an Org contains 1000+ SObjects
Recently I run into a need to list all custom object and standard object in my org in an UI Component to allow user to search and select. I have tried several ways of implementation, but none of them ...
0
votes
0
answers
69
views
How to determine which record was successful when deleting, updating, or adding a sobject Collection to a CompositeAPI sub-request?
I want to save the ID issued by salesforce to the corresponding record in the local DB. I also want to know how to determine which record failed.
Reasons below
In the case of new additions, the ID ...
0
votes
1
answer
31
views
SurveySubject object relationship
I'm a little bit confused. Doc says that SurveySubject has ParentId field that
Unique identifier of the SurveyInvitation object or SurveyResponse object that is associated with this survey-object ...
0
votes
1
answer
62
views
Addressing Restrictions in Passing SObject Fields: LWC to Apex
There are several topics related to this issue:
Salesforce LWC - Pass standard object to Apex Class
How do I pass sObject record from LWC to Apex Controller?
How do I pass a SObject record from LWC ...
0
votes
0
answers
27
views
Can't access financial goals object in Financial Cloud (FSC) using apex
I am trying to access financial goal object from my financial cloud using apex command as follows:
Map<String, Schema.SObjectType> allSObjects = Schema.getGlobalDescribe();
for (String ...
0
votes
1
answer
46
views
Compare 2 Lists of same sobject and store the unique records in a list
I have 2 List<Sobject> one contains existingRecordsList and other updateRecordList.
existingRecordsList = (Account:{abc__c=a0o7a000,xyz__c=a0o5r000, id =a0o5r000002GaHhAAK})
updateRecordList = ...
-3
votes
1
answer
195
views
Line: 4, Column: 23 Invalid constructor syntax, name=value pairs can only be used for SObjects: Contact
Line: 4, Column: 23
Invalid constructor syntax, name=value pairs can only be used for SObjects: Contact
List<Contact> conList = new List<Contact>(); // here is Empty List for Contact ...
0
votes
0
answers
94
views
How to convert an OpportunityChangeEvent to an Opportunity object?
I am writing an async apex trigger for Opportunity.
The trigger gives me an OpportunityChangeEvent object which has all the fields of Opportunity (in addition to fields like "ChangeEventHeader&...
-1
votes
1
answer
363
views
Get all Records Using sObject Collections
I see this page:
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobjects_collections_retrieve_post.htm
but it seems to require a list of record IDs. I ...
0
votes
1
answer
698
views
Why are there some objects which are not visible in Object Manager in salesforce?
There are some standard objects like ContentDocumentLink, ContentDocument, ContentDocumentHistory; why these aren't visible in object manager or schema builder even when you have admin privileges.
...
0
votes
1
answer
464
views
How to Dynamically cast the type of an 'Object' in apex at runtime
Let's say we have a Map<String,Object> we got from an lwc, and we need to create records for any given SObject that can change based on some custom metadata type records.
I have the following ...
2
votes
1
answer
355
views
Composite sObject Collection call not reaching limit
The Composite API docs (ref) asserts that
You can have up to 25 subrequests in a single call. Up to 5 of these
subrequests can be sObject Collections or query operations, including
Query and QueryAll ...
0
votes
1
answer
423
views
How to deactivate all flows via sf cli
I'm trying to deactivate all active flows via sf data cli
I saw docs said we can deactivate if via Metadata field
You can activate and deactivate flows with the Metadata field.
Below command is ...
0
votes
0
answers
17
views
Updating a custom field in a packaged org updates the namespaced field instead, is there a workaround for this? [duplicate]
I'm currently testing my application in a packaged org, and am trying to update a field:
custom_field__c of the lead object that i created. I use my app installed in the packaged org to update that ...
1
vote
1
answer
462
views
How to write to a non-writeable field such as formula fields or CreatedDate during unit tests?
TL;DR
How can I write to non-writeable SObject fields while running apex unit tests?
Background
While creating unit tests that check a method's functionality independent of any DML functions, it is ...
0
votes
1
answer
1k
views
How to iterate over map with id and Sobject list
I have the following piece of code:
map<id,List<Spot__c>> spotMap = new map<id,List<Spot__c>>();
List<application__c> apPList = [SELECT ID, Account__r.id,(SELECT id,...
0
votes
1
answer
281
views
How to retrieve exactly all SObject Names in Object Manager
On the Object Manager tab, My org has 173 objects with 172 standard objects and 1 custom object. However, when I use System.debug(Schema.getGlobalDescribe().values().size()); It returns 1058 records. ...
0
votes
0
answers
434
views
Error when querying Salesforce REST API - order object with full query, but works fine with limited results and querying just one field
I'm encountering an issue when performing a REST API query for order object on Salesforce, specifically when using a full query that includes multiple fields. However, the query works perfectly fine ...
-3
votes
1
answer
454
views
What do the SObject.clone(preserveId, isDeepClone, preserveReadonlyTimestamps, preserveAutonumber) method parameters do?
At Apex code while cloning the record:
clone(preserveId, isDeepClone, preserveReadonlyTimestamps, preserveAutonumber)
Need to know the each parameter how does it work.
Contact obj = new Contact(Id ='...
0
votes
2
answers
116
views
Adjust for missing fields in Test SObject avoid erorr - SObject row was retrieved via SOQL without querying the requested field
I have created an Apex Class to compare the current and prior values of SObjects. If differences are found the field labels are outputted to a ; separated string which I am using to populate a Multi-...
0
votes
1
answer
189
views
Copy Field Values to a different Record Type
We need to keep an audit of all field changes for a Custom Object, Work Experience. I have created a separate child Object, Work Experience Audit, which has all of the same editable fields. I have ...
2
votes
0
answers
118
views
Is it applicable to check equality with operator for SObject field values?
Recently I was writing a code to check if sobject had changed values in fields. And I came across a question. Right now I have this code to check values diff:
Object newValue = newRecord.get(fieldName)...
0
votes
0
answers
62
views
Update sObject from Batch Apex when the sObject's other custom field value is invalid
So we have a situation where we have some custom sObjects that have some custom fields that are picklists.
From time to time an Apex batch job runs to update picklists in Custom_Field_1__c.
Now we add ...
0
votes
1
answer
434
views
Possible to remove or ignore errors from trigger-context SObject after .addError() in Apex?
With Apex, after calling .addError() on a trigger record is there any way to subsequently remove that error such that the DML operation will complete successfully?
I don't see any Database methods (...
0
votes
1
answer
218
views
Cannot find field level permissions on standard field
I am having some SOQL queries fail when I include the field "Street" when querying for a Lead. This is the kind of query I'm running and the error message back:
SELECT Id, Name, firstName, ...
1
vote
3
answers
629
views
Query Lookup Relationship With SOQL Not Working
I have a SalesForce custom object named Loan__c which has a Lookup field called LoanLead__c and I'm trying to query that relationship with SOQL but I'm getting an error when I run the query SELECT Id, ...
2
votes
0
answers
133
views
Package version creation failed Invalid type: EntitySubscription
I am getting the below error when I am trying to create a patch version.
Package version creation failed with an unknown error. Invalid type: EntitySubscription.
This Sobject is available in the ...
0
votes
0
answers
157
views
Deployment error on sobject without message
I am pushing Account sobject on save. File is CustomData__c.object, not multiple for each field. It says "Deployed with status SUCCEEDED_PARTIAL, but no error is displayed. They are displayed in ...
-1
votes
2
answers
188
views
Bulk update of custom field value in salesforce object failing due to custom validations and triggers
I added a custom field to opportunity salesforce object. It's name is externalId__c.
The field is added to the object. However when I am trying to update the value of externalId__c for all the records,...
0
votes
1
answer
316
views
UserAppInfo query fails because userId not there
I'm tracking down a bug that fails on this query because it returns no rows. The user I'm using is relatively new and still working out the kinks:
UserAppInfo userApp = [SELECT Id, AppDefinitionId
...
-1
votes
1
answer
1k
views
what sobjects are supported in a queue
What objects can in include in Queues? Online i can see only these objects can be in included in a Queue: Cases, Leads, Tasks, Contact requests, Orders, Service contracts, Knowledge articles and ...
0
votes
0
answers
242
views
Running Salesforce Code Analyzer for method version 3
I'm trying to run the SalesForce Code Analyzer on the new version 3 to a unique method called deleteQuery and the deleteQuery has a parameter Id here what I'm using: "sfdx scanner:run:dfa --...
3
votes
1
answer
2k
views
How to calculate how much storage a CSV will use when uploaded to SObject
So I have a .csv file that contains ~12,000 rows and on my local filesystem takes up about 3MB of data. I assumed that when I imported this csv into a Salesforce Object, the data would still take up ...
1
vote
1
answer
258
views
How do field types convert from json and SF object
I am working on a lwc. I am passing a array of json objects into a apex method. The parameter for the apex method is a List<Work_Items> where work items is a SF object. At run time apex converts ...
1
vote
0
answers
179
views
SystemModStamp and LastModifiedDate contains different date
I have checked and part of my records contains different date in that fields. Systemmodstamp is 9.10 and LastModifiedDate is 5.10. I thought that systemmodstamp is different because of automated ...
0
votes
0
answers
42
views
Record field is empty after package update
I have custom managed package and created record of sObject(Response__c) from that package with namespace. And after updating package to new version one field(Message__c) became empty. That field is ...
0
votes
0
answers
298
views
Reenable 'Visibility' field on FeedItem
We've been using the 'Visibility' field (the one defined here) on the 'FeedItem' object. These have been removed/changed/hidden somehow -- all of the sudden, we get "No such column 'Visibility' ...
0
votes
0
answers
29
views
Need help figuring out how to build a Questionaire based on objects in Salesforce, display in an Experience Cloud Page with generated URL
I'm trying to wrap my head around something pretty complicated.
Users want to dynamically build out a form with Questions and Answers that will display on a Experience Cloud Page.
There will be a bank ...
0
votes
1
answer
471
views
common.apex.runtime.impl.ApexFieldToken
We have using SmartFactory class from long time. But, recently we are facing issues while running smartfactory unit class. Smart Factory Git hub repo. When I try to see the logs I've found out this. I ...
0
votes
0
answers
358
views
Attachment API returning Status=Not Found, StatusCode=404 from Apex but works from Anonymous window & workbench
I am trying to access Attachment info using
/services/data/v56.0/sobjects/Attachment/\<attachment-id\> which works fine from workbench.
It also works fine from Anonymous window using
URL....
0
votes
1
answer
257
views
I need to update all Contact Fields dynamically , I am trying throught Schema.SObjectType but getting some Error
I need to update all contact records from one record to another record which has 333 fields. It takes time to update this. I thought of updating the sobject field dynamically, but I'm getting "...
1
vote
2
answers
457
views
APEX equivalent for SObject Tree -> insert nested objects
I often encounter usecases where i need to insert nested objects.
While i know that it is feasible to leverage external Ids to achieve the insert in a single DML operation
Account a = new Account(Name=...
1
vote
1
answer
916
views
Give access to User.ProfileId without "View Profile and Configuration" permission
I created a flow that has to access the profileId of Order.Owner:
But when the user runs the flow, the following error occurs:
"An error occurred: The flow failed to access the value for ...
0
votes
1
answer
671
views
Why I have a standard field Case.isStopped field on one environment but I don't have the same field on the second environment?
I have a field Case.isStopped (label: Stopped) on my Developer organization which I created 2 weeks ago but I don't have that field on full copy Sandbox that was created a long time ago
Can it be ...
1
vote
1
answer
863
views
sObject.clone() - Does this method clone values in fields marked as Unique?
Given the below Account field:
foo__c Text(255) (External ID) (Unique Case Insensitive)
If we use the following in Apex code, does a value in the foo__c field get copied over to the newly cloned ...
0
votes
1
answer
521
views
What set of fields gets returned from .getSObject(fieldName)?
I'm working on a function that does a series of .getSObject() calls from an Account record to get three fields from one of the related records.
The issue I'm having is one of the fields returns a ...
1
vote
1
answer
280
views
Yet another question on SObject's isSet function
This is a question about the isSet function on SObjects. Compare a similar question from 2019 here, but the discussion did not go beyond OwnerId.
In my case, Apex gets a QuoteLineItem from a query (in ...
1
vote
1
answer
217
views
prefix Phone field, different Objects
I have a method in beforeInsert trigger, when new SObject is inserted it should add a numeric prefix. That alone is working, but my assignment now is make it much shorter.
Currently I'm having 1 block ...
-1
votes
1
answer
375
views
Add List of Inserted Id's to generic sObject List
I need to replicate the standard "Create Records" Flow Element in an Invocable Apex Class so that I can include some additional code before and after the insert.
I am using generic sObject ...