• Nate Reed 3
  • NEWBIE
  • 15 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
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
 
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';
    }

}

 
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
 
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';
    }

}