50 Most Commonly Used Apex Methods In Salesforce

Here are 50 more Apex methods in Salesforce:

1. clear(): Clears all elements from a collection.

2. containsKey(): Determines whether a map contains a certain key.

3. equalsIgnoreCase(): Compares two strings for equality, ignoring case.

4. floatValue(): Returns a float value for a given number.

5. getClass(): Returns the runtime class of an object.

6. getInitialValue(): Returns the default value for a given sObject field.

7. getInstance(): Returns a new instance of an sObject for the specified record type.

8. getValues(): Returns values of a map as a list.

9. isEmptyOrNull(): Determines whether a string is null or empty.

10. merge(): Merges a list of fields into a single string.

11. putAll(): Adds all key-value pairs from one map to another map.

12. removeByKey(): Removes a key-value pair from a map by specifying the key.

13. round(): Rounds a number to a specified number of decimal places.

14. startsWithIgnoreCase(): Determines whether a string starts with a certain substring, ignoring case.

15. substringAfter(): Retrieves a substring that occurs after a certain character or substring.

16. system.debug(): Outputs debug information to the debug log.

17. system.runAs(): Runs a block of code with the permissions of a specified user.

18. system.assert(): Asserts that a given condition is true, and throws an exception if it is not.

19. Assert.areNotEquals(): Asserts that two values are not equal, and throws an exception if they are.

20. Assert.areEquals(): Asserts that two values are equal, and throws an exception if they are not.

21. Assert.isTrue(): Asserts that the specified condition is true.

22. Assert.isFalse(): Asserts that the specified condition is false.

23. system.today(): Returns today's date in the user's time zone.

24. system.now(): Returns the current date and time in the user's time zone.

25. test.startTest(): Starts a new testing context.

26. test.stopTest(): Ends the current testing context.

27. test.loadData(): Loads test data from static resources.

28. test.setMock(): Configures a mock service for testing.

29. test.isRunningTest(): Determines whether the current code is running in a test context.

30. JSON.deserializeUntyped(): Deserializes a JSON string into an object without type checking.

31. JSON.deserializeStrict(): Deserializes a JSON string into an Apex object with strict type checking.

32. JSON.deserializeWithDate(): Deserializes a JSON string into an Apex object with date handling.

33. JSON.serializePrecisely(): Serializes an Apex object with precision.

34. Math.PI: Returns the value of pi.

35. Math.pow(): Returns the result of raising a number to a certain power.

36. Math.floor(): Rounds a number down to the nearest integer.

37. Math.random(): Returns a random number between 0 and 1.

38. string.join(): Joins an array of strings, adding a separator between each item.

39. string.padding(): Pads a string with another string, adding extra characters where necessary.

40. string.split(): Splits a string into an array of substrings.

41. string.valueOf(): Converts an object to a string.

42. Database.delete(): Removes one or more sObjects from the database.

43. Database.undelete(): Restores one or more sObjects that have been deleted from the database.

44. Database.update(): Updates one or more sObjects in the database.

45. Database.query(): Executes a SOQL query and returns a list of sObjects.

46. Database.insert(): Inserts one or more sObjects into the database.

47. Database.saveResult(): Returns the results of a Database.insert or Database.update operation.

48. Date.valueOf(): Converts a string to a date.

49. Date.newInstance(): Creates a new date from year, month, and day values.

50. Date.today(): Returns today's date in the GMT time zone.

0 Comments