New and Changed Apex Classes

These classes, methods, annotations, and interfaces are new or have changed in this release.

New Methods

The following class has new methods.

System.Test Class
invokeContinuationMethod(Object, Continuation)
Invokes the callback method for the specified controller and continuation in a test method.
setContinuationResponse(String, System.HttpResponse)
Sets a mock response for a continuation HTTP request in a test method.

Changed Methods

The following classes have changed methods.

Auth.SessionManagement Class
getCurrentSession()
The returned map now also includes the LoginHistoryId and LoginDomain values. The LoginHistoryId value is an 18-character ID for a successful login event. The LoginDomain value is the domain associated with the current session, and is used to help prevent access from other domains. For more information, see Improve Security with Session Domain Locking.
validateTotpTokenForKey(String, String)
This method now throws an invalid parameter value exception if the shared key is invalid, a no data found exception if the key doesn’t exist, and a security exception if the current user exceeds the maximum of 10 token validation attempts. In previous releases, all of these circumstances threw an unexpected exception.
Flow.Interview Class
start()
In addition to autolaunched flows, this method also supports user provisioning flows.
Note

Note

This release contains a beta version of user provisioning for connected apps that is production quality but has known limitations. For information on enabling this feature for your organization, contact Salesforce.

Objects That Support Triggers

You can now create triggers for the following object.

ChatterMessage
To create a trigger for private messages from Setup, click Customize | Chatter | Triggers | ChatterMessage Triggers. Alternatively, you can create a trigger from the Developer Console by clicking File | New | Apex Trigger, and then selecting ChatterMessage from the sObject drop-down list.

New Annotations

The following annotations have been added.

InvocableMethod
Use the InvocableMethod annotation to identify methods that can be run as invocable actions.
InvocableVariable
Use the InvocableVariable annotation to identify variables used by invocable methods in custom classes.

For more information, see Invocable Actions.

New Classes

The following classes have been added.

Database.DMLOptions.DuplicateRuleHeader Class
Determines whether a record that’s identified as a duplicate can be saved. Duplicate rules are part of the Duplicate Management feature.
allowSave
Set to true to save the duplicate record. Set to false to prevent the duplicate record from being saved.
Database.DuplicateError Class
Contains information about an error that occured when an attempt was made to save a duplicate record. Use if your organization has set up duplicate rules, which are part of the Duplicate Management feature.
getDuplicateResult()
Returns the details of a duplicate rule and duplicate records found by the duplicate rule.
getFields()
Returns an array of one or more field names. Identifies which fields in the object, if any, affected the error condition.
getMessage()
Returns the error message text.
getStatusCode()
Returns a code that characterizes the error.
Datacloud.AdditionalInformationMap Class
Represents other information, if any, about the matched records.
getName()
Returns the element name.
getValue()
Returns the value of the element.
Datacloud.DuplicateResult Class
Represents the details of a duplicate rule that detected duplicate records and information about those duplicate records.
getDuplicateRule()
Returns the developer name of the executed duplicate rule that returned duplicate records.
getErrorMessage()
Returns the error message configured by the administrator to warn users they may be creating duplicate records. This message is associated with a duplicate rule.
getMatchResults()
Returns the duplicate records and match information.
isAllowSave()
Indicates whether the duplicate rule will allow a record that’s identified as a duplicate to be saved. Set to true if duplicate rule should allow save; otherwise, false.
Datacloud.FieldDiff Class
Represents all fields and their values for a duplicate and its matching record.
getDifference()
Returns how the field values compare for the duplicate and its matching record.
getName()
Returns the name of the field that is different between two matched records.
Datacloud.MatchRecord Class
Represents a duplicate record.
getAdditionalInformation()
Returns other information about a matched record. For example, a matchGrade represents the quality of the data for the D&B fields in the matched record.
getFieldDiffs()
Returns all fields and field values for the duplicate and its matching record.
getMatchConfidence()
Returns the ranking of how similar a matched record’s data is to the data in your request. Must be equal to or greater than the value of the minMatchConfidence specified in your request. Returns -1 if unused.
getRecord()
Returns the fields and field values for the duplicate.
Datacloud.MatchResult Class
Represents the duplicate results for a matching rule.
getEntityType()
Returns the entity type of the matching rule.
getErrors()
Returns errors that occurred during matching for the matching rule.
getMatchEngine()
Returns the match engine for the matching rule.
getMatchRecords()
Returns information about the duplicates for the matching rule.
getRule()
Returns the developer name of the matching rule.
getSize()
Returns the number of duplicates detected by the matching rule.
isSuccess()
Returns false if there’s an error with the matching rule, and true if the matching rule successfully ran.
Reports.EvaluatedCondition Class
Contains the individual components of an evaluated condition for a report notification, such as the aggregate name and label, the operator, and the value that the aggregate is compared to.
getAggregateLabel()
Returns the localized display name of the aggregate.
getAggregateName()
Returns the unique API name of the aggregate.
getCompareTo()
Returns the value that the aggregate is compared to in the condition.
getOperator()
Returns operator used in the condition.
getValue()
Returns the actual value of the aggregate when the report is run.
Reports.NotificationActionContext Class
Contains information about the report instance and threshold information for a report notification.
getReportInstance()
Returns the report instance associated with the notification.
getThresholdInformation()
Returns the threshold information associated with the notification.
Reports.ThresholdNotification Class
Contains a list of evaluated conditions for a report notification.
getEvaluatedConditions()
Returns a list of evaluated conditions for the notification.
System.Address Class
Contains methods for accessing the component fields of address compound fields.
getCity()
Returns the city field of this address.
getCountry()
Returns the text-only country name component of this address.
getCountryCode()
Returns the country code of this address if state and country picklists are enabled in your organization.
getDistance(Location, String)
Returns the distance from this location to the specified location using the specified unit.
getLatitude()
Returns the latitude field of this address.
getLongitude()
Returns the longitude field of this address.
getPostalCode()
Returns the postal code of this address.
getState()
Returns the text-only state name component of this address.
getStateCode()
Returns the state code of this address if state and country picklists are enabled in your organization.
getStreet()
Returns the street field of this address.
System.Continuation Class
Use the Continuation class to make callouts asynchronously to a SOAP or REST Web service.
Constructors:
Continuation(Integer)
Creates an instance of the Continuation class by using the specified timeout in seconds. The timeout limit is 60 seconds.
Properties:
continuationMethod
The name of the callback method that is called after the callout response returns.
timeout
The timeout of the continuation in seconds. Limit: 60 seconds.
state
Data that is stored in this continuation and that can be retrieved after the callout is finished and the callback method is invoked.
Methods:
addHttpRequest(HttpRequest)
Adds the HTTP request for the callout that is associated with this continuation.
getRequests()
Returns all labels and requests that are associated with this continuation as key-value pairs.
getResponse(String)
Returns the response for the request that corresponds to the specified label.
System.Location Class
Contains methods for accessing the component fields of geolocation compound fields.
getDistance(Location, String)
Calculates the distance between this location and the specified location using the specified unit.
getDistance(Location, Location, String)
Calculates the distance between two points, using an approximation of the haversine formula and the specified unit.
getLatitude()
Returns the latitude field of this location.
getLongitude()
Returns the longitude field of this location.
newInstance(Decimal, Decimal)
Creates a location by using the specified latitude and longitude.
UserProvisioning.UserProvisioningLog Class
Provides methods for writing messages to monitor outbound user provisioning requests.
log(String, String, String, String, String)
Writes a specific message, such as an error message, to monitor the progress of a user provisioning request. This method has three variations: a message associated with a user provisioning request, a message and status associated with a user provisioning request or a message associated with a user provisioning request and an individual user.
UserProvisioning.UserProvisioningPlugin Class
The UserProvisioningPlugin base class implements Process.Plugin for programmatic customization of the user provisioning process for connected apps.
buildDescribeCall()
Use this method to add more input and output parameters to those defined in the base class.
describe()
Returns a Process.PluginDescribeResult object that describes this method call.
getPluginClassName()
Returns the name of the class implementing the plugin.
invoke(Process.PluginRequest)
Primary method that the system invokes when the class that implements the interface is instantiated.

New Interfaces

The following interfaces have been added.

Auth.SamlJitHandler interface:
Use this interface to control and customize Just-in-Time user provisioning logic during SAML single sign-on.
createUser(Id, Id, Id, String, Map<String,String>, String)
Returns a User object using the specified Federation ID. The User object corresponds to the user information and may be a new user that hasn’t t been inserted in the database or may represent an existing user record in the database.
updateUser(Id, Id, Id, Id, String, Map<String,String>, String)
Updates the specified user’s information. This method is called if the user has logged in before with SAML single sign-on and then logs in again, or if your application is using the Existing User Linking URL.
Reports.NotificationAction interface:
Report notifications for reports that users have subscribed to can trigger a custom Apex class, which must implement this interface.
execute(NotificationActionContext)
Executes the custom Apex action specified in the context parameter of the context object, Reports.NotificationActionContext. The object contains information about the report instance and the conditions that must be met for a notification to be triggered.