public class ContactProcessBuilderHandler {
@InvocableMethod
public static void sendNotification(List<String> contactIds) {
sendEmailToContacts(contactIds);
}
@future //Use callout = true, for callouts
public static void sendEmailToContacts(List<String> contactIds) {
//Write your business logic
}
}
Ternary operator is a one liner replacement for if-then-else statement. If x, a Boolean, is true, y is the result. Otherwise z is the result. Note that x cannot be null.
Example:
Boolean isLeapYear = true;
//Using Ternary Operator
String msg = isLeapYear ? 'It is a leap year.' : 'It is not a leap year.';
System.debug('Message - ' + msg);
If “isLeapYear” is true, assign the message value to “It is a leap year”, else assign message value to “It is not a leap year”.
trigger AccountTrigger on Account (before delete, before update, before insert, after insert, after update) {
if (trigger.isDelete) {
for (Account acc : trigger.old) {
acc.addError('You cannot delete account records');
}
}
}