Question 1mediummultiple choice
Read the full Process Automation, Logic, and Integration explanation →SF-PD2 Process Automation, Logic, and Integration • Complete Question Bank
Complete SF-PD2 Process Automation, Logic, and Integration question bank — all 0 questions with answers and detailed explanations.
public class OrderTriggerHandler {
public static void handleBeforeUpdate(List<Order> newOrders, Map<Id, Order> oldMap) {
Set<Id> accountIds = new Set<Id>();
for(Order ord : newOrders) {
if(ord.Status != oldMap.get(ord.Id).Status) {
accountIds.add(ord.AccountId);
}
}
Map<Id, Account> accounts = new Map<Id, Account>([
SELECT Id, (SELECT Id, Status FROM Orders) FROM Account WHERE Id IN :accountIds
]);
for(Order ord : newOrders) {
Account acc = accounts.get(ord.AccountId);
// Complex business logic evaluating child orders
}
}
}public class OrderProcessor {
@future(callout=true)
public static void processOrder(Set<Id> orderIds) {
List<Order__c> orders = [SELECT Id, Status__c FROM Order__c WHERE Id IN :orderIds];
for(Order__c ord : orders) {
ord.Status__c = 'Processed';
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint('https://api.example.com/orders');
req.setMethod('POST');
HttpResponse res = h.send(req);
}
update orders;
}
}{
"status": "error",
"message": "Maximum stack depth reached",
"code": 101
}public class IntegrationService {
public static void processData() {
HttpRequest req = new HttpRequest();
req.setEndpoint('https://api.external.com/data');
req.setMethod('POST');
Http h = new Http();
HttpResponse res = h.send(req);
}
}{
"error": "System.LimitException",
"message": "Too many SOQL queries: 101"
}{
"status": 403,
"message": "Insufficient Permissions"
}