Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ProcessHandlerShowAccounts
- {
- public class AccountParameter
- {
- @InvocableVariable(required=true)
- public Id accountId;
- @InvocableVariable(required=true)
- public String name;
- }
- @InvocableMethod(label='handle' description='Send the Accounts variables passed from Process Builder to the webservice')
- public static void handle(AccountParameter [] accountParameters)
- {
- webServiceCallOut(accountParameters[0].accountId,accountParameters[0].name);
- }
- public static void webServiceCallOut(ID n, String a){
- Http http = new Http();
- HttpRequest req = new HttpRequest();
- req.setEndpoint('https://Accounts'
- +'?sfdcid='+n+'?operation='+a);
- String username = 'nameishi';
- String password ='123';
- Blob headerValue = Blob.valueOf(username + ':' + password);
- String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
- req.setHeader('Authorization', authorizationHeader);
- //Create a new Http object to send the request object
- //a response object is generated as a result
- HTTPResponse res = http.send(req);
- System.debug(res.getBody());
- }
- }
Add Comment
Please, Sign In to add comment