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.
626
questions
2
votes
1
answer
29
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
44
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 ...
-2
votes
0
answers
42
views
Is there a way to retrieve a list of search results from Account SObject via a form?
I am looking at creating a form that can retrieve a list of rows for a LWC Datatable. Usually I use an apex method to call out to an API, but for this I need to utilize the account sobject.
For this ...
-2
votes
0
answers
28
views
Send Salesforce Object details via REST API
I am currently working on a project in which the requirement is to connect Salesforce with Sharepoint and send an Object record details via Rest API, I browsed on many forums but all I could find is ...
0
votes
0
answers
16
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
79
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
108
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
104
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
197
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
91
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
74
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
89
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 ...
1
vote
1
answer
59
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
54
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
174
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
71
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
132
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
92
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
80
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
135
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
132
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
583
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
183
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
1k
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
132
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
115
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
38
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
138
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
28
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
200
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
231
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
0
answers
68
views
Aura with LWC override new button do nothing after redirect back
I am using aura wrapper with lwc to override new button. It works great first time, but second time my aura is not triggered at all. If i reload page it works.
<aura:component description="...
0
votes
1
answer
127
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 "...
0
votes
0
answers
71
views
Salesforce CLI Export Error sObject type 'Product2' is not supported
I logged into CLI successfully with the command
sfdx force:auth:web:login -r https://login.salesforce.com
And tried exporting using the below command and below is the error
C:\Users\xxxxx>sfdx ...
1
vote
2
answers
248
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
480
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
331
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
471
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
209
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
199
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
169
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
219
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 ...
-2
votes
1
answer
198
views
The map collection declared by apex is not accepted by lwc
The map collection declared by apex is not accepted by lwc.
Schema to get all field names corresponding to the object.I made apex code using SObjectType.
System.debug was used to verify that there ...
1
vote
0
answers
116
views
How to change field value of sObject in LWC?
I need to write the equivalent code in LWC . Here a sObject is defined in aura cmp and then it is assigning a value to one of its field which is Source__c. CreateCaseActivity is a sObject. How can i ...
1
vote
1
answer
168
views
Default value for new lookup fields
I have created a lookup between two custom objects.
Object A is an existing object that has a new lookup to object B, a new object.
For the next few months I need to have a scheduled batchjob to keep ...
1
vote
1
answer
763
views
Schema.getGlobalDescribe().get(objectType); doesn't work with custom objects
I have a method that returns a map of all the fields where the field's API name is the key and the object Schema.SObjectField is the value.
private static Map<String, Schema.SObjectField> ...
0
votes
2
answers
630
views
Cleaner way to filter specific object ids from List <String>?
I am trying to update one of the related objects once the Account merge is completed.
Database.MergeResult results = Database.merge(masterAcct, duplicateAcct, false);
getUpdatedRelatedIds() method ...
1
vote
1
answer
58
views
Get notified when a new custom field is added or an existing field metadata is updated
I would like to get alerted when a custom field is added or if an existing field metadata is updated such as if it's data classification setting has changed.
Programmatically only thing I can think of ...
1
vote
1
answer
159
views
Hello everyone, I need some help with triggers
So basically, I'm struggle in this trigger. What I have to do is: get the max Commission Amount value of the contacts from an Account, check which is the largest and trigger a check box field called &...
0
votes
1
answer
160
views
Create custom object using Partner wsdl which has a parent ID (SOAP API)
When creating a new record using the partner wsdl SOAP API how do I add the parent id to the generic sObject.
We have a parent record of Account__c and child records of Store_Visit__c
My attempted ...