You need to sign in to do that
Don't have an account?
Leo Darkstar
How to see Future activities in logs ?
I am attempting to see the portion of this code which is part of the @Future method run in logs. But I don't see it in the Debug Logs. Shouldn't it be showing up with a Future Handler label ? Is there a different user I need to track in order to see Future Handler logs ? I also can't find it in the Apex Jobs.
I really just want to verify that the @Future code is actually being run.
...or is just not being run ?
public class UpdateContactPCRController { @InvocableMethod public static String updateContact(String recordId){ String contactId = ''; List<Contact> contactToBeupdate = new List<Contact>(); if(String.isNotBlank(recordId)){ List<Program_Contact_Role__c> programContacList = [SELECT Id,Contact__c,Program_Name__c FROM Program_Contact_Role__c WHERE Id =:recordId AND Contact__c != null]; contactId = programContacList[0].Contact__c; if(String.isNotBlank(contactId)){ contactToBeupdate = [Select Id,Pardot_Action_Trigger__c,PCR_Register_Button_Link__c,PCR_URL_for_UI__c FROM Contact Where Id =: contactId Limit 1]; contactToBeupdate[0].Program_Contact_Role_Id__c = recordId; } List<Program_Communication_Recipients__c> programCommunicationRecs = [Select Id,Name, Program_Communication__r.Program__r.Buyer__r.Name,Receipient__c, From Program_Communication_Recipients__c Where Program_Communication__r.Program__c =: programContacList[0].Program_Name__c AND Receipient__c =: programContacList[0].Id]; contactToBeupdate[0].PCR_Welcome_Message__c = String.valueOf(programCommunicationRecs[0].Program_Communication__r.Welcome_Message__c); if(contactToBeupdate.size() > 0){ update contactToBeupdate; } pardotCallout(contactToBeupdate[0].Id); return 'Updated Successfully'; } else{ return 'some message'; } } @future(callout=true) public static void pardotCallout(String contactId) { String returnedResponseFromPardot = Http_Utility_Pardot.pardotCreateProspect(new Set<Id> {contactId}); // new treatment here with the returned value included DML operations. // further logic if any based on the response you get from Pardot } }
Future methods can be debugged in two ways. First, you can open the developer console and perform the action that causes the future method to be called. Second, you can enable debug logs in Setup / Monitoring / Debug Logs.
If you do not see anything in logs then you can confirm your method is not being invoked.
Reference:
https://salesforce.stackexchange.com/questions/200920/why-do-debug-logs-not-always-work-for-a-future-method
https://salesforce.stackexchange.com/questions/76893/debug-or-view-status-of-a-future-method/76894
Thanks,
Vinay,
That first reference you gave seems to be the same type of case as me. It sounds like he was able to see FutureHandler in the Logs portion of DeveloperConsole. But I'm not sure how to run this code in DeveloperConsole because it would require a field change to initiate. So is there a way for me to see FutureHandler in the Debug Log ? I am currently tracking my test user in there. Can I track a different type of 'system' user in order to see Future Handler operations in the Debug Log ? I also don't see it in Apex Job. Thank you very much.
Thanks,
I've now gotten other Future Handler operatons to show up on my Debug Log. But I still can't see a Future Handler for the @future I have in this particular class. I've never run code which required field input through the Developer Console before. This is the full class. Do I have any reason to think that the @Future code at the end of the class is not executing ?
Thank you for any help you can give.