• Esteban Rocha 3
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hello,
I'm very new to APEX and I'm trying to test a trigger that calls a Class. 
Apex Class:
public class NewAccount {

@Future(callout=true)
public static void PassNewAccoundIDToQuest(string AccID) {

    try {
    String url = 'https://integration.csmlive.com/service.asmx/AddAccount';
    
    String DataToSend = '{';
    DataToSend = DataToSend + '"SFKey": "' + AccID + '"';
    DataToSend = DataToSend + '}';

    Http h = new Http();
    HttpRequest req = new HttpRequest();
        req.setTimeout(2000);
        
    req.setEndpoint(url);
    req.setMethod('POST');
    req.setHeader('Content-Type', 'application/json');
   
    req.setBody(DataToSend);
    
    h.send(req);
    
        } catch(System.CalloutException e) {
    //Exception handling goes here.... retry the call, whatever
}
    
    //HttpResponse res = 
}
    
}
Apex Trigger:
trigger TriggerAccount on Account (after insert) {
        for(Account a: Trigger.new){
        NewAccount.PassNewAccoundIDToQuest(a.Id);
         }

The test on Class is covered but I'm struggling to get the trigger covered. Any help, please? Thanks
 
Hello community.

I'm a Salesforce Admin but I have a question for integrating our in-house platform system that we use to manage projects with Salesforce. the Idea in mind is to pull back projects from our platform to Salesforce (this will be on a custom object) and the idea is just to bring a high level of information. Now to understand this every project is created after 3 different layers of folders in order to organise projects by events, clients or years.
The data from our system is in our servers and our in-house platform team says it is difficult or nearly impossible to bring all of this together.

I just want your recommendations or idea on this. I have tried to search on the internet but haven't got enough information.

Many Thanks!
 
Hello,
I'm very new to APEX and I'm trying to test a trigger that calls a Class. 
Apex Class:
public class NewAccount {

@Future(callout=true)
public static void PassNewAccoundIDToQuest(string AccID) {

    try {
    String url = 'https://integration.csmlive.com/service.asmx/AddAccount';
    
    String DataToSend = '{';
    DataToSend = DataToSend + '"SFKey": "' + AccID + '"';
    DataToSend = DataToSend + '}';

    Http h = new Http();
    HttpRequest req = new HttpRequest();
        req.setTimeout(2000);
        
    req.setEndpoint(url);
    req.setMethod('POST');
    req.setHeader('Content-Type', 'application/json');
   
    req.setBody(DataToSend);
    
    h.send(req);
    
        } catch(System.CalloutException e) {
    //Exception handling goes here.... retry the call, whatever
}
    
    //HttpResponse res = 
}
    
}
Apex Trigger:
trigger TriggerAccount on Account (after insert) {
        for(Account a: Trigger.new){
        NewAccount.PassNewAccoundIDToQuest(a.Id);
         }

The test on Class is covered but I'm struggling to get the trigger covered. Any help, please? Thanks