You need to sign in to do that
Don't have an account?
debprakash shaw
how do I write the test class for this code please suggest
thanks
Help with Test Class for Invocable Apex Action called from FlowInput
public class CreateCaseUsingFlow { @InvocableMethod(label = 'Attach File') public static List<FlowOutput> createFile(List<FlowInput> list_FlowInput) { System.debug('list_FlowInput[0].attachment ==>' +list_FlowInput[0].attachment); System.debug('list_FlowInput[0].caseId ==>' +list_FlowInput[0].caseId); System.debug('list_FlowInput[0].attachmentName ==>' +list_FlowInput[0].attachmentName); Boolean isFileSuccessfullyCreate = false; String attachment = list_FlowInput[0].attachment; String attachmentName = list_FlowInput[0].attachmentName; ContentVersion conVer = new ContentVersion(); conVer.ContentLocation = 'S'; conVer.PathOnClient =attachmentName; conVer.Title = attachmentName; conVer.VersionData = EncodingUtil.base64Decode(attachment); insert conVer; Id conDocId = [SELECT ContentDocumentId FROM ContentVersion WHERE Id =:conVer.Id].ContentDocumentId; ContentDocumentLink conDocLink = New ContentDocumentLink(); conDocLink.LinkedEntityId = list_FlowInput[0].caseId; conDocLink.ContentDocumentId = conDocId; conDocLink.shareType = 'V'; insert conDocLink; isFileSuccessfullyCreate = true; List<FlowOutput> list_FlowOutput = new List<FlowOutput>(); FlowOutput obj_FlowOutput = new FlowOutput(); obj_FlowOutput.isFileSuccessfullyCreate = isFileSuccessfullyCreate; list_FlowOutput.add(obj_FlowOutput); return list_FlowOutput; } public class FlowInput { @InvocableVariable(label=' Case Id' required='true') public String caseId; @InvocableVariable(label='ContentVersion attachment' required='true') public String attachment; @InvocableVariable(label='ContentVersion attachmentName' required='true') public String attachmentName; } public class FlowOutput { @InvocableVariable(label='isFileSuccessfullyCreate') public Boolean isFileSuccessfullyCreate; } }
how do I write the test class for this code please suggest
thanks
but get an error like
//Variable does not exist: firstInput
//Invalid type: CreateCaseUsingFlow.FlowInputs
//Variable does not exist: firstInput
//Invalid type: CreateCaseUsingFlow.FlowInputs
//Variable does not exist: firstInput
redeem.microsoft.com (https://microsoftcomredeem.com)