• Aaron Bishop
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 2
    Likes Given
  • 1
    Questions
  • 4
    Replies
Hey All,

I've created a trigger and a couple of methods to do the following: When a contact is created or updated, Salesforce sends an outbound HTTP request to POST data to another location. Salesforce then updates a field on that original contact with part of the response supplied by the other side. The methods themselves seem to be working just fine, but when I call them from the trigger, the field on the contact doesn't get updated. 

My thought is that perhaps Salesforce isn't allowing the update because it is trying to avoid an infinite loop (an update to the contact calls the trigger, which updates the contact, which calls the trigger, etc.). I've included the basics of my code below, and I appreciate any feedback given.
trigger ContactTrigger on Contact (before insert, before update) {
    for(Contact c : trigger.new){
        Integration.startContactSync(new List<String> {c.Id});
    }
}


global class Integration{
    
    @future(callout=true)
    public static void startContactSync(List<String> conId){
        Contact con = [SELECT Id, Foreign_Key__c FROM Contact WHERE Id = :conId.get(0)];

        if(String.isBlank(con.Foreign_Key__c )) {
            system.debug('calling SurefireConnection.createContact()');
            createContact(con.Id);
        }
        else {
            system.debug('calling SurefireConnection.updateContact()');
            updateContact(con.Id);
        }
    }

    public static String createContact(Id conId){
        Contact con = [SELECT Id, Foreign_Key__c FROM Contact WHERE Id = :conId];
        ...  
        //Set up HTTP POST request. This works.
        ...
        con.Foreign_Key__c = http.send(req);
        update con;
        return 'Success';
    }

    public static String updateContact(Id conId){
        Contact con = [SELECT Id, Foreign_Key__c FROM Contact WHERE Id = :conId];
        ...  
        //Set up HTTP POST request. This works.
        ...
        return 'Success';
    }
Thanks in advance for the help.
I need to find a way to keep certain users from creating new opportunities, thereby only being able to create them by converting a lead.  We have a sales process that starts with lead creation, and it completely throws off our metrics when an opportunity is created directly rather than through lead conversion.  That being said, one team SHOULD be able to do create directly (even if it's only from the 'clone' button).  SF support said I need custom code for this and I've no clue where to start.  Any help would be appreciated.
Hi,

I just created a visual workflow and tried to activate but couldn't get the "Activate" button anywhere.
Could some one please guide me.

Thank YouActivate button missing in Visual Workflow
So I have created flows before where the flow is started from a record using a custom button, and that record's ID is passed into the flow as a variable, which is great!

However, I now want to do this but starting from a list view, where I would select (check) a bunch of records and then click a custom button to start the flow, and have the record IDs of all the checked records pass into the flow as a list of variables (I think it would be an sObject variable?)

Is this possible? 
Thanks
  • February 20, 2015
  • Like
  • 3
Just recently started running into this error message: "TotalRequests Limit exceeded."

We should have 7000 requests/day. Looking at our API call report, I have no idea how we're coming anywhere close to this 7000 limit. Is there part of this report that's missing or a different way to see how we're exceeding our total request limit?

This is affecting some time-sensitive, production applications we have including a link to our billing/invoicing system Intacct and an application we use to create licenses for our customers. Any help would be really appreciated. Thanks!