14
votes
Accepted
Can someone please explain what is meant by sObject?
An SObject represents a specific table in the database that you can discretely query. The API Name is what you reference as ending in __c. Standard SObjects have names like Account or Opportunity, ...
10
votes
Accepted
what is the use of data type in salesforce custom object?
You can define the object name with text type or autonumber
If you select Text then you can manually enter value in name field.
If you select Autonumber then Name field will be generate automatic.
...
8
votes
Accepted
How do I count objects available in a Salesforce organization?
You can easily do this using Global Describe
map<String, Schema.SObjectType> GlobalMap = Schema.getGlobalDescribe();
for (Schema.SObjectType Obj : GlobalMap.values()) {
Schema....
8
votes
Accepted
The length of the first and last names
A quicker way to do that is to use describe call in Apex.
System.debug(Contact.FirstName.getDescribe().length); //Prints 40
System.debug(Contact.LastName.getDescribe().length); //Prints 80
It also ...
7
votes
Check if a field exists
You can use Force.com Eclipse IDE to get all standard and custom objects using the RMB Project | Add Remove Metadata Components then use the Search command on the field name to find the object
7
votes
Accepted
Pass a JavaScript object to Apex controller in lightning
Apex is strongly typed, which means that it has to know in advance what type of data it's dealing with. In this specific case, you could have just passed in an Id:
public static void changeProgram(Id ...
7
votes
How to Create an Apex class that returns Account objects
method named accountsByState that accepts a state abbreviation as a
string and returns a List of Account objects
You are not passing the parameter for state.
public static List<Account> ...
6
votes
Accepted
How Custom Iterators with Iterable Work
The overall answer to this is that there is an Apex Batch Handler which controls batch class execution. You could think of it like a method that calls your start method, then launches threads which ...
6
votes
Accepted
Apex equivalent to associative array?
You need to create a Wrapper class for this.
Example :
public class TestWrapper {
public static void pushValue(){
list<fieldWrapper> n = new list<fieldWrapper>();
...
6
votes
Accepted
Compare same Object types dynamically
The snippet you posted in the comments is failing due to a common mistake. Its an order of operations error, because you're adding an extra string to your comparison, it gets merged into your string ...
6
votes
The length of the first and last names
you can check details about fields on Contact SOAP API guide
FirstName - The contact’s first name up to 40 characters.
LastName - Required. Last name of the contact up to 80 characters.
6
votes
Accepted
Must I cast a JSON deserialization into an object?
Apex, like Java and other Object-Oriented Languages before it, are strongly-typed languages. This means that the compiler can check if an object is compatible with an assignment or operation before ...
5
votes
Can someone please explain what is meant by sObject?
A common direct use of the SObject class is when writing Apex code that you want to work with various actual types e.g. something that works with Account and Contact and any other standard or custom ...
5
votes
how to allow employees to post reviews for candidates
There are lots of ways you can do something like this, but the most important thing to consider first are what the other requirements of the application will be.
Will all of your employees be ...
5
votes
Accepted
Is it possible to dynamically set properties of an `Object` using Apex?
For some isolated cases - yours is one of them - there is this (ab)use of the serialize methods:
Invoice inv = (Invoice) JSON.deserialize(JSON.serialize(new Map<<String, Object>{
'Ref' =&...
5
votes
Accepted
Send only udpated fields instead of all the field information
You can use the CDC (Change Data Capture) to get updates only on updated fields. You could also write manual code (Apex) to create a change delta, although this might require a lot of CPU time ...
5
votes
What is the "Image" object?
Salesforce has introduced Consumer Goods Cloud, a new industry product that enables companies related to consumer goods to optimize revenue growth and maximize ROI with the help of advanced retail ...
5
votes
Accepted
LWC JavaScript: Can't Add a Property to Objects While Looping through an Array of Those Objects
Presuming that this came from a server call, you need to copy the objects entirely:
let tempFieldWrapperArray = this.fieldSetWrapper.fieldWrappers.map(element => ({...element}));
Or:
let ...
5
votes
How to check object name by objectId?
You don't need the Describe API. Just use the Id class's methods. Adapted from the documentation:
Contact a = new Contact(LastName = 'Test');
insert a;
Id myId = a.id;
System.assertEquals(Contact....
5
votes
Accepted
apex : convert object to a list
Unfortunately apex doesn't handle list-level type conversion so if "obj" is a List<Object> and even if each Object is actually a String you still cannot convert that list directly to a ...
5
votes
Accepted
How Apex Clone Works
When using the clone method, you need to pass in four true values to preserve/copy everything.
sObject clonedRecord = sourceRecord.clone(true, true, true, true);
You can read more in the ...
4
votes
Accepted
View object fields and data
If you are talking about a quick select rather than typing all the fields, Workbench is the best tool for me. You can navigate into query > soql query and from below view you can select all the fields ...
4
votes
What is the Object in which public group data is stored?
Public Group API Name is Group and to add members use GroupMember.
In Dataloader, if Group does not display in the default list, check Show all objects to see a complete list of objects that you can ...
4
votes
Accepted
How to create records of a custom object?
You should create tabs to see the 'objects' in App Launcher.
Go to Setup > Tabs > Custom Object Tabs > New
4
votes
Accepted
Is there a way to query all fields on an object that have 'Default Value' ticked (and possibly filled in)?
No, with SOQL it's not possible to access meta data on the object you are quering. Actually, I don't see any reason why would you need working with metadata using SOQL? Nevertheless, you can easily do ...
4
votes
Accepted
Apex object returning null
This is because of "name shadowing." You named both the parameter e and the property e, so you're just assigning the value to itself (i.e. nothing happens). You need to use this if you ...
4
votes
Apex cast List<Object> into List<SObject>
You can't add store an Object in an Account, nor a List of Object in a List of Account.
If, and only if, you're sure it's the correct type, you can "cast" to override:
accList.addAll((List&...
4
votes
Salesforce - Admin - Object restriction
You can't remove/restrict a user's permissions below their profile level. Instead, you would want to remove the object access for the profile, then create a Permission Set with that object's access ...
4
votes
Accepted
Reactive array of objects and "Use Lightning Web Security for Lightning Web Components"
Primitives are reactive, objects are not. However, you can just add @track to make an object reactive:
import { LightningElement, track } from 'lwc';
export default class Widgets extends ...
3
votes
Can I Mass Modify Object Settings > Tab Settings for All Profiles? (Default On/Default Off/Hidden)
SELECT Id,Name,ParentId,SystemModstamp,Visibility FROM PermissionSetTabSetting where Parent.Profileid='00000000000'
You can only manipulate the tab as long as it is Default On or Default Off.
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
object × 280apex × 70
custom × 29
custom-object × 22
fields × 19
json × 18
visualforce × 16
trigger × 16
soql × 13
sobject × 13
lightning-web-components × 10
profile × 10
map × 10
javascript × 9
lookup × 9
permissions × 9
query × 8
list × 8
record × 7
api × 6
class × 6
record-type × 6
user × 6
standard-objects × 6
lightning × 5