You need to sign in to do that
Don't have an account?

Error: Compile Error: Method does not exist or incorrect signature
Hi, Apex noob here. I'm trying to create a trigger that calls the method logTransaction in my "Blockchain" class. It's failing with the message "Error: Compile Error: Method does not exist or incorrect signature: Blockchain.logTransaction(String, String, String, String) at line 3 column 21
The method signatures do seem to match. I've tried implementing this as both an instance method and static method and I get the same message when I try to invoke either.
My class:
trigger OpportunityInsertTrigger on Opportunity (before insert) { System.debug('Triggered on insert of opportunity. Updating blockchain...'); String result = Blockchain.logTransaction('123456789', 'DNB', 'Salesforce', 'Opportunity'); }
The method signatures do seem to match. I've tried implementing this as both an instance method and static method and I get the same message when I try to invoke either.
My class:
public class Blockchain { public static String logTransaction(String duns, String fromEntity, String toEntity, String state) { Map<String,String> arguments = new Map<String,String>(); arguments.put('from', fromEntity); arguments.put('to', toEntity); arguments.put('duns', duns); arguments.put('state', state); return makeRequest(arguments); } public static String makeRequest(Map<String,String> arguments) { Payload payload = new Payload(); payload.argumentMap = arguments; String url = ''; Httprequest request = new HttpRequest(); request.setMethod('POST'); request.setEndpoint(url); request.setBody(payload.toJSONString()); Http http = new Http(); HttpResponse response = http.send(request); System.debug('Response status code: ' + response.getStatusCode()); System.debug('Response: ' + response.getBody()); return 'OK'; } }
only @future methods can be accesses in the triggers.
please add@future annotation to your method in Blockchain class
All Answers
only @future methods can be accesses in the triggers.
please add@future annotation to your method in Blockchain class
please mark my answer as best answer
Thanks