As of May 31, 2023, we have updated our Code of Conduct.

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
60 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
27 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
36 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
44 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 ...
6 votes
1 answer
2k views

Unable to read SObject error in Lightning Component when record has been queried from the database

I had encountered the "Unable to read SObject" error when attempting to pass an SObject record from Lightning to an @AuraEnabled Apex method. Based on this question, I first tried setting the "...
2 votes
1 answer
5k views

Convert Schema.SObjectfield to string

I have a List of Schema.SObjectfield and I want to convert it to String. I am getting below error. System.JSONException: Apex Type unsupported in JSON: Schema.SObjectField Here is my approach. ...
0 votes
1 answer
50 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
28 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
2 answers
37 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
37 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
29 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
60 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,...
2 votes
1 answer
1k views

Which Objects are displayed in PermissionSet Object Settings?

I am a noob with Salesforce, please bare with my question. I am creating an App which enables easy edit/creation of PermissionSets on an ORG. In this process, I am creating a tree view with ...
3 votes
2 answers
9k views

Get Object API name of any Lookup field

I have requirement where I need the object name of any lookup field on any object. for fetching lookup field I am using Schema class Schema.DescribeFieldResult f = Schema.sObjectType....
0 votes
1 answer
46 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 ...
3 votes
3 answers
10k views

Apex - break list into multiple small lists before processing

I have a list of 15,000 records. I can maintain the count in a flag. Integer Counter = 15000; I want to break my main list into 3 small lists. Each list should contain 5,000 records. First list ...
-1 votes
1 answer
53 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
63 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 --...
1 vote
1 answer
3k views

SObjectCollection in Composite request limits

According to the composite API documentation, "You can have up to 25 subrequests in a single call. Up to 5 of these subrequests can be query operations, including Query, QueryAll, and “Query More” ...
15 votes
1 answer
4k views

Bad rightOperand type: got SObjectScriptRow

I just want to know what is SObjectScriptRow! All I can find about it is this question. I'm building an invocable method to be used from a process, where I have one input parameter: a list of an ...
3 votes
1 answer
402 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
48 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
53 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
31 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 ...
1 vote
1 answer
141 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
0 answers
62 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
27 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
80 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
110 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
50 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
56 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
49 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
1k views

Get Account.Name using SObject.Get()

I'm trying to get value of a lookup field, by using SObject.Get(). I'm using this method because i want to make this class generic. That's the relevant piece of code: for(SObject sobject_i : ...
1 vote
2 answers
119 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=...
0 votes
1 answer
210 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
148 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 ...
0 votes
1 answer
192 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
99 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
131 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
123 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
97 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 ...
1 vote
0 answers
550 views

Invalid Field for SObject

I have 2 fields that I'd like to use in my VFP. Valores_ativos_e_passivos__c is working fine, but when I try to use Ativos_e_passivos__c I receive the Invalid field for SObject error. What am I ...
-2 votes
1 answer
121 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 ...
5 votes
2 answers
2k views

Methods to Check if Sobjects are Equal

Use Case: Need to allow changes to only one specific field on an opportunity when at a certain stage. Problem: How to efficiently determine within a trigger context that a only the specific field ...
1 vote
0 answers
94 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
122 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 ...
0 votes
1 answer
523 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
1 answer
265 views

Display sObject List in Visualforce page

I want to create an overview of a list which contains content from different objects. I will try to add in this list the files, tasks, events, emails and notes. I would like to show this list on the ...
0 votes
0 answers
54 views

Salesforce API when will trigger fire on updating multiple dependant fields

I am updating multiple fields within a single sobjects/customobj__c Salesforce client Patch request. All these fields are on the same customobj__c object for a single record. I have say 2 fields in ...
0 votes
2 answers
322 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
2 3 4 5
13