fork download
  1. public class GPMulesoftBillable {
  2. public void callMuleSoftAPI() {
  3. // Create the HTTP request
  4. HttpRequest req = new HttpRequest();
  5. req.setEndpoint(': https://d...content-available-to-author-only...b.com/sfdc);
  6. req.setMethod('POST');
  7. req.setHeader('Content-Type', 'application/json');
  8.  
  9.  
  10. String jsonPayload = '{"notifications":{"Notification":[{"GP_Project__c":{"Id":"a0kVN00000KH","GP_Oracle_PID__c":"NA","GP_RESPONSIBILITY_ID__c":"57295","GP_RESP_APPL_ID__c":"275","GP_USER_ID__c":"42685"}},{"GP_Project__c":{"Id":"a0kVN00000KH","GP_Oracle_PID__c":"NA","GP_RESPONSIBILITY_ID__c":"57295","GP_RESP_APPL_ID__c":"275","GP_USER_ID__c":"42685"}}]}}';
  11. req.setBody(jsonPayload);
  12.  
  13. // Send the HTTP request
  14. Http http = new Http();
  15. HttpResponse res = http.send(req);
  16.  
  17. // Handle the response
  18. if (res.getStatusCode() == 200) {
  19. System.debug('Response: ' + res.getBody());
  20. } else {
  21. System.debug('Error: ' + res.getStatusCode() + ' ' + res.getStatus());
  22. }
  23. }
  24.  
  25.  
  26. public static void triggerMuleSoftAPI() {
  27. if (UserInfo.getOrganizationId() == '00DU9000003AHlpMAG') {
  28. for (SObject record : Trigger.new) {
  29. if ((record.isChanged('GP_Approval_Status__c') && record.get('GP_Approval_Status__c') == 'Approved') ||
  30. (record.isChanged('GP_Oracle_Re_Submission_Counter__c') && record.get('GP_Approval_Status__c') == 'Approved')) {
  31. MuleSoftAPIService service = new MuleSoftAPIService();
  32. service.callMuleSoftAPI();
  33. }
  34. }
  35. }
  36. }
  37. }
Success #stdin #stdout #stderr 0.01s 8924KB
stdin
Standard input is empty
stdout
Object: UndefinedObject error: did not understand #GPMulesoftBillable
MessageNotUnderstood(Exception)>>signal (ExcHandling.st:254)
UndefinedObject class(Object)>>doesNotUnderstand: #GPMulesoftBillable (SysExcept.st:1448)
UndefinedObject>>executeStatements (prog:1)
stderr
./prog:2: parse error, expected '}'
./prog:37: Unterminated string, attempting recovery