You need to sign in to do that
Don't have an account?
Jonathan Wolff 7
Get record Id from flow to apex class
Hello, I have now tried for some time to create a screen flow thatgets the campaign Id to set the campaign to completed and create a PDF and stores it in the Campaign files. The only problem I have is, that I do not know how to get the campaign Id into my apex Class Invocable Method. Could you tell me how to implement a InvocableVariable or something like that, so I can insert the record Id into the class?
The Apex class:
The Apex class:
public class SerienbriefSpeichern{ @InvocableMethod(Label = 'Serienbrief' description='') public static void Serienbriefspeichern() { PageReference page = Page.Campaign_PDF; Blob contentBlob = !Test.isRunningTest() ? page.getContentAsPDF() : Blob.valueOf('Hardcoded sample text for Test class'); ContentVersion cv = new ContentVersion(); cv.VersionData = contentBlob; cv.Title = System.today().year() + '_' + System.today().month() + '_Serienbrief'; cv.PathOnClient = System.today().day() + '_' + System.today().month() + 'Serienbrief.pdf'; cv.Vertraulichkeitsstufe__c = 'Intern'; cv.Dokumentenklasse__c ='Anderes Dokument (nicht aufbewahrungspflichtig)'; insert cv; cv = [SELECT Id, ContentDocumentId FROM ContentVersion WHERE Id = :cv.Id LIMIT 1]; ContentDocumentLink cdl = new ContentDocumentLink(); cdl.ContentDocumentId = cv.ContentDocumentId; cdl.ShareType = 'I'; cdl.LinkedEntityId = '7017a000000pVQnAAM'; insert cdl; } }
Can you refer the below article will help you to proceed further on your requirement.
https://unhandledsunshine.com/2021/08/12/invocable-methods-how-to-send-data-between-flow-and-apex/
https://developer.salesforce.com/forums/?id=906F00000005GQdIAM
If this information helpful, Please mark it as best answer.
Thanks!!
so how would the List in List look like for getting the current campaign Id. I already created the Id as a variable and just want to pass it into the apex. Is this really required for my topic?