Skip to main content

Firstly, in the trigger, pass the record ID and deletion time to the outboundcall method instead of the entire trigger.old list.

trigger keyfobdelete on Key_Fob_Dispenser__c (before delete) {
    for (Key_Fob_Dispenser__c keyfob : trigger.old) {

Secondly, in the outboundcall method, you need to construct the JSON payload using the record ID and deletion time. Here’s an example of how you can modify the method to include the necessary information:

public class keyfobdeletehandlerclass {
    public static void outboundcall(Id recordId, DateTime deletionTime) {
        HttpRequest req = new HttpRequest();
        req.setHeader('Content-Type', 'application/json');
        // Construct JSON payload with record ID and deletion time
        String jsonBody = '{"recordId": "' + recordId + '", "deletionTime": "' + deletionTime + '"}';
        // Perform the callout
        // Add your code to send the request and handle the response here

I hope this information is helpful for you.

Subscribe For More Updates


Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!