• khaviya G Senthilkumar
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies
Hello,
          I am trying to do a POST request. But I keep getting this message in my endpoint. My code shows no error and the JSON is getting printed in the debug window. but I don't know what am doing wrong.
Please help me with this.



public  with sharing class SageAPIController  extends TriggerHandler {
     @future (callout=true)
    public static void getCustomerId(String acc)
     {
         HttpRequest req = new HttpRequest();
         
         req.setEndpoint('  xxxxxxx ');
         req.setMethod('POST');
         req.setHeader('Content-Type', 'application/json;charset=UTF-8');
         
         req.setBody(acc);
         Http h = new Http();
         HttpResponse response = h.send(req);
         String str = response.getBody();
         if (response.getStatusCode() != 200) 
         {
             System.debug('The status code returned was not expected: ' + response.getStatusCode() + ' ' + response.getStatus());
         } 
         else
         {
             System.debug(response.getBody());
         }  
         
     }
    public override void beforeInsert() {
    for(Account Acc_record : (List<Account>) Trigger.new) {
        
       
         String jsonString  = '{"name": "'+Acc_record.Name+'", "display_contact": { "print_as": "'+Acc_record.Name+'","company_name": "'+Acc_record.Name+'", "email1": "'+Acc_record.McLabs2__Email__c+'"  ,"fax": "'+Acc_record.Fax+'","first_name": "'+Acc_record.Owner_Name__c+'","phone1": "'+Acc_record.Phone+'","mailaddress": { "address1": "'+Acc_record.BillingStreet+'", "city": "'+Acc_record.BillingCity+'", "state": "'+Acc_record.BillingState+'" }"} }';
           System.debug('jsonString'+jsonString);
        
        getCustomerId(jsonString);
    }
  }
    
   
}


 
I have created a custom object and a tab. However its not visible on the page layout and as a tab as well. 
Checked evrything below
Profiles
 Permission sets
App manager
Page layout

Nothing seems to work. Please help out
I am trying to display the fields based on dependent values in picklist. After writing the code, when i try to save it, am getting an error
I have created a custom object and a tab. However its not visible on the page layout and as a tab as well. 
Checked evrything below
Profiles
 Permission sets
App manager
Page layout

Nothing seems to work. Please help out
I am trying to display the fields based on dependent values in picklist. After writing the code, when i try to save it, am getting an error