Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 3512

An sObject represents an object, such as an Account or Campaign. An sObject is the base object for all objects in Apex.

0 votes
Accepted

How to add fields dynamically to sObject

There are two ways to set fields values: SObject acc = new Account(); // Schema.FieldType, Object acc.put(Schema.Account.Description, 'Description of Account'); or // Field API name, Object acc.put …
Ashwani's user avatar
  • 22.7k
1 vote
Accepted

How to get recentlyviewed objects for all users?

You can not view recently viewed record of any other user except current. It is something like hacking into someone account without permission. RecentlyViewed object only give access of current use …
Ashwani's user avatar
  • 22.7k
1 vote

Unit Test Fail - list has no rows for assignment to Sobject

Below method would cause the issue in case when the query has not returned any record:- public static Data_Policy__c getPolicy() { // Method to obtain data policy text Data_Policy__c …
Ashwani's user avatar
  • 22.7k
25 votes

How to convert a string to sObjectType

Account name in String String objectStr = 'Account'; // Convert to schema.sObjectType Schema.SObjectType convertType = Schema.getGlobalDescribe().get(objectStr); // Create an instance of that type Sobject … why making Sobject ? Account acc = (Account)convertType.newSObject(); …
Ashwani's user avatar
  • 22.7k
2 votes
Accepted

How to query another Objects field to get it's value

you need to provide contact ID to Case in test method: public static testMethod void testTrigger() { Area__c ar = new Area__c(Name = 'CA'); insert ar; Contact conts = new …
Ashwani's user avatar
  • 22.7k
0 votes

Creating list from custom objects with relationship

Instead of List of List it is better to use Wrapper Class (Inner class). Wrapper classes are easy to understand and implement. Ex: // Store Model Name and Cars associated with it …
Ashwani's user avatar
  • 22.7k