You need to sign in to do that
Don't have an account?
Suman Kuch
I have an API that has callouts and DMLs, these DMLs executes after future callouts but not executing. Is there any limitations on that? Please check the code where I'm doing wrong.
Please check and give me clue what I'm doing wrong here.
Thanks in advance.
DMLs after future callouts not working
Hi,
I have an API that has callouts and DMLs, these DMLs executes after future callouts but not executing. Is there any limitations on that? Please check the code where I'm doing wrong.
@future(callout=true) private static void uploadFile(String objFolderName,ID objID, String attachID, String custBoxAttachID, String fName) { try{ String HomeFolderID = Label.HOME_FOLDER_ID; createFolderIn(objFolderName,'sObjectName',HomeFolderID); system.debug(' request body '+'FolderID='+sObjectFolderID+'&AttachID='+attachID); String reqBody = 'FolderID='+sObjectFolderID+'&AttachID='+attachID+'&FileName='+fName; String endPointURL='https://thirdpartywebsite.com'; sendHttpRequest(endPointURL,reqBody,'POST'); //this httpcallout system.debug(' Attachment.getId() :: '+custBoxAttachID); BoxAttachment__c custAttachment = [select id from BoxAttachment__c where id = :custBoxAttachID]; custBoxAttachment.BoxFileID__c = boxFileID; custBoxAttachment.Status__c = 'Success'; update custBoxAttachment; //This is not working Attachment att = [select id from Attachment where id = :attachID]; delete att;//This is not working att = [select id from Attachment where id = :attachID]; system.debug(' after delete :: '+att); system.debug(' Successfully completed '+custBoxAttachment.Status__c); }catch(Exception e){ ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR, 'Cannot upload attachment, Please check with Admin.')); System.debug(' Cannot uploadFileToBox: actual error is '+e.getMessage()); } }
Please check and give me clue what I'm doing wrong here.
Thanks in advance.
Well I was able to update object, but still not able to delete Attachment.
I changed the line no 12;instead of returning just ID, I used Id, BoxFile__c,Status__C then I was able to update. Please advice on Delete record