function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lex08Lex08 

Method does not exist or incorrect signature: void sendReq(String)

I am trying to call the flow through an apex class I created to attach the files to the Account object using Conga Template. This is the apex class I had created for the same.
@RemoteAction
public class FileAttachment{

    @InvocableMethod
    public static void file(List<Id> presId) {
        
        Set<Id> presc = new Set<Id>();
        presc.addAll(presId);
        
        sendReq(presc);
        
    }
    
    @future(callout=true)
    public static void sendReq(Set<Id> medId) {
        
        HealthCloudGA__EhrMedicationPrescription__c m = [SELECT Id,HealthCloudGA__Prescriber__c,HealthCloudGA__Account__c 
                                                         FROM HealthCloudGA__EhrMedicationPrescription__c
                                                         WHERE Id IN :medId];  
        
        Account a = [SELECT Id,FirstName,LastName FROM Account WHERE Id = :m.HealthCloudGA__Account__c];
        
        String sessId = UserInfo.getSessionId();
        String servUrl = Url.getSalesforceBaseUrl().toExternalForm()+'/services/Soap/u/29.0/'+UserInfo.getOrganizationId();
        
        String url2 = 'https://www.appextremes.com/apps/conga/pm.aspx'+
            '?sessionId='+sessId+
            '&serverUrl='+EncodingUtil.urlEncode(servUrl, 'UTF-8')+
            '&id='+m.Id+
            '&TemplateId=a2n0i0000000U09AAE'+
            '&QueryId=[Account]a2f0i00000003cN%3Fpv0%3D'+m.HealthCloudGA__Account__c+','+
            '[Dosage]a2f0i00000003by%3Fpv0%3D'+m.Id+','+
            '[DoctorLicense]a2f0i00000003cX%3Fpv0%3D'+m.HealthCloudGA__Prescriber__c+
            '&SC0=1'+
            '&SC1=SalesforceFile'+
            '&DS7=1'+
            //'&OFN=Prescription+'+a.LastName+'+'+
            '&AttachmentParentId='+m.HealthCloudGA__Account__c+
            '&DefaultPDF=1&APIMode=1';
        
        
        System.debug(url2);
        
        Http http = new Http();
        HttpRequest req = new HttpRequest();
        req.setEndpoint(url2);
        req.setMethod('GET');
        req.setTimeout(60000);
        
        // Send the request, and return a response
        HttpResponse res = http.send(req);
        System.debug(res);
        
        
        //return res.getStatus() + ' => ' + res.getBody();
        
        Messaging.SingleEmailMessage semail = new Messaging.SingleEmailMessage();
        String[] toAddresses = new String[] {'wade08@gmail.com'};

        semail.setToAddresses(toAddresses); 
        semail.setSubject('Single Email message Example'); 
        semail.setPlainTextBody('Hello!!!!!!!!!!This is a test email to test single email message program '+url2); 
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] {semail}); 
    }
}



And I executed this in the anonymous window:
System.debug(''+FileAttachment.sendReq('a0z0i000000630vAAA'));




I am getting this error:
Line: 1, Column: 32
Method does not exist or incorrect signature: void sendReq(String) from the type FileAttachment
 
Best Answer chosen by Lex08
Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Lex08

The method call needs to pass a set not a single Id.
Used : System.debug(''+FileAttachment.sendReq('a0z0i000000630vAAA'));
Should Be : System.debug(''+FileAttachment.sendReq(new Set< String>{'a0z0i000000630vAAA'}));

Cheers!!!

All Answers

Syed Insha Jawaid 2Syed Insha Jawaid 2
Hi Lex08

The method call needs to pass a set not a single Id.
Used : System.debug(''+FileAttachment.sendReq('a0z0i000000630vAAA'));
Should Be : System.debug(''+FileAttachment.sendReq(new Set< String>{'a0z0i000000630vAAA'}));

Cheers!!!
This was selected as the best answer
Lex08Lex08
Yes. I tried to execute this  in the anonymous window:
Set<id> params = new Set<id>();
params.add('a0z0i000000630vAAA');
FileAttachment.sendReq( params);
This was the error I got.User-added image