Advanced Developer Certification, DEV 501 Quick Points Part-II

  1. The apex array is dynamic, but java array is static
  2. If field history is enabled for an object the data which is getting stored in field history will be anyType.
  3. Enum data type methods:ordinal():- returns the position of item in the listName():- returns the name of the enum item as a stringvalues():- static method that returns the list of values
  4. SaveResult object has 3 methods.Id getId()List<Database.Error> getErrors()Boolean isSuccess()
  5. If the DML operation contains only one record we can use saveResult instead of list<SaveResult>
  6. External field contains externalid attribute.
  7. Execution of setsavePoint(), rollback() counts against the total number of DML statements.
  8. You cannot add isdeleted flag into page layout.
  9. Trigger by definition will not receive more than 200 records in trigger.new
  10. Each DML statement can only operate on one type of SObject at a time.
  11. Merging limited to 3 records at a time and its limited to leads, accounts, contacts.
  12. If there are uncaught exceptions while performing DML operations then system will roll back.
    SavePoint sp = database.setSavepoint();
    Database.rollback(sp);
  13. Approval Process:-ProcessRequest ,ProcessSubmitRequest, ProcessWorkItemRequest.ProcessRequest is a parent class for both ProcessSubmitRequest and ProcessWorkItemRequest.
  14. Approval process should be defined for approval process through apex.
  15. Webservice , remoteaction methods cannot overloaded,
  16. Apex cannot access file system or create temporary files in salesforce.
  17. SObject clone method has 4 parameters1.preserve id2.deepclone - All fields on the SObject are duplicated in memory, including relationship fields3.Readonly timestamps - Determines whether the read-only timestamp fields are preserved or      cleared in the duplicate.4.preserve_autonumber - Determines whether auto number fields of the original object are            preserved or cleared in the duplicate.
  18. SObject toString method returns the object values into string.
  19. Apex sharing can be set only for custom objects, but standard objects can be shared with apex. The sharing reason for standard objects will always be manual.
  20. If history tracking is enabled then Object__history object will be created automatically for that custom object.
  21. full,read,read/write, write sharing are there for an object. Full is granted only for record owners.
  22. Interfaces are implicitly virtual, so no need to define virtual keyword for interfaces.
  23. Organization wide sharing changes will remove the redundant sharing records.
  24. Inner class behave like static java inner class.
  25. Virtual keyword used to extends or override the class and methods.
  26. Abstract keyword used if the class contains incomplete implementations.
  27. Global classes are used for Email service,webservice and AppExchange products.
  28. Schema.DescribeFieldResult F = Account.AccountNumber.getDescribe();Schema.DescribeFieldResult F = Schema.SObjectType.Account.fields.Name;Map<String, Schema.SObjectField> M = Schema.SObjectType.Account.fields.getMap();Schema.DescribeSobjectResult[] results = Schema.describeSObjects(types);
    //It can have 100 objects as argument to it.
  29. Accessing all SObjects:-Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
  30. In dynamic soql you can use bind variable in query string, but you cannot use SObject field as bind variable in dynamic soql.
  31. DML operation always require list of sobjects, list<object> will not support in DML.
  32. Salesforce automatically recalculates sharing for all records on an object when its organization-wide sharing default access level changes. The recalculation adds Force.com managed sharing when appropriate. In addition, all types of sharing are removed if the access they grant is considered redundant.
  33. Apex sharing reasons and Apex managed sharing recalculation are only available for custom objects.
  34. An anonymous block is Apex code that does not get stored in the metadata, but that can be compiled and executed using one of the following:• Developer Console• Force.com IDE• The executeAnonymous SOAP API call:Note the following about the content of an anonymous block (for executeAnonymous, the code String):• Can include user-defined methods and exceptions.• User-defined methods cannot include the keyword static.• You do not have to manually commit any database changes.• If your Apex trigger completes successfully, any database changes are automatically committed. If your Apex trigger does not complete successfully, any changes made to the database are rolled back.• Unlike classes and triggers, anonymous blocks execute as the current user and can fail to compile if the code violates the user's object- and field-level permissions.• Do not have a scope other than local. For example, though it is legal to use the global access modifier, it has no meaning. The scope of the method is limited to the anonymous block.• When you define a class or interface (a custom type) in an anonymous block, the class or interface is considered virtual by default when the anonymous block executes. This is true even if your custom type wasn’t defined with the virtual modifier. Save your class or interface in Salesforce to avoid this from happening. Note that classes and interfaces defined in an anonymous block aren't saved in your organization.
    The return result for anonymous blocks includes:
    • Status information for the compile and execute phases of the call, including any errors that occur• The debug log content, including the output of any calls to the System.debug method• The Apex stack trace of any uncaught code execution exceptions, including the class, method, and line number for each call stack element.
  35. Trigger.new is used only by insert and update triggers.
  36. You can only use the webService keyword in a trigger when it is in a method defined as asynchronous; that is, when the method is defined with the @future keyword.
  37. The code block of a trigger cannot contain the static keyword. Triggers can only contain keywords applicable to an inner class.
  38. If any record that fires a trigger includes an invalid field value (for example, a formula that divides by zero), that value is set to null in the new, newMap, old, and oldMap trigger context variables.
  39. Be aware of the following considerations for trigger context variables:• trigger.new and trigger.old cannot be used in Apex DML operations.• You can use an object to change its own field values using trigger.new, but only in before triggers. In all after triggers, trigger.new is not saved, so a runtime exception is thrown.• trigger.old is always read-only.• You cannot delete trigger.new.
  40. In before delete trigger you can update field values of object using DML statements, not using trigger.new.
  41. In after undelete you can update the field values using DML statements.
  42. You cannot use Trigger.new to update field values in any after triggers.
  43. You can update the fields on object using trigger.new in before trigger if there are new version of sobject being created in trigger.
  44. The after undelete trigger events only run on top-level objects.
  45. The getContent and getContentAsPDF PageReference methods aren't allowed in triggers.
  46. Methods with the future annotation have the following limits:• No more than 10 method calls per Apex invocation• The maximum number of future method invocations per a 24-hour period is 250,000 or the number of user licenses in your organization multiplied by 200, whichever is greater.
  47. You can only have 100 scheduled Apex jobs at one time.
  48. To schedule an Apex class to run at regular intervals, first write an Apex class that implements the Salesforce-provided interface
  49. Schedulable interface.The Schedulable interface contains one method that must be implemented, execute.global void execute(SchedulableContext sc){}The implemented method must be declared as global or public.
  50. Cron trigger schedule string syntax:Seconds Minutes Hours Day_of_month Month Day_of_week optional_year
  51. You can't use the getContent and getContentAsPDF PageReference methods in scheduled Apex.
  52. Scheduling example:scheduledMerge m = new scheduledMerge();String sch = '20 30 8 10 2 ?';String jobID = system.schedule('Merge Job', sch, m);batchable b = new batchable();database.executebatch(b);
  53. both of the above method needs to implement schedulable interface.
  54. An easier way to schedule a batch job is to call the System.scheduleBatch method without having to implement the Schedulable interface.System.scheduleBatch (reassign, 'job example',
  55. To obtain the total count of all Apex scheduled jobs, excluding all other scheduled job types, perform the following query.
  56. Note the value '7' is specified for the job type, which corresponds to the scheduled Apex job type.SELECT COUNT() FROM CronTrigger WHERE CronJobDetail.JobType = '7'
  57. Synchronous Web service callouts are not supported from scheduled Apex. To be able to make callouts, make an asynchronous callout by placing the callout in a method annotated with @future(callout=true) and call this method from scheduled Apex.
  58. You can only have five queued or active batch jobs at one time
  59. To use a callout in batch Apex, you must specify Database.AllowsCallouts in the class definition.
    For example:
    global class SearchAndReplace implements Database.Batchable<sObject>,Database.AllowsCallouts{}
  60. A maximum of 50 million records can be returned in the Database.QueryLocator object.
  61. Each batch Apex invocation creates an AsyncApexJob record. Use the ID of this record to construct a SOQL query to retrieve the job’s status, number of errors, progress, and submitter.

Comments

Popular posts from this blog

List of Key Prefixes in Salesforce

SFDX Install CPQ in Scratch org