• Michael Lobel 3
  • 0 Points
  • Member since 2015

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 0
After installing the Zendesk Package for Salesforce, I'm trying to create a basic Salesforce apex trigger based off the Zendesk Ticket sObject, in order to update a boolean on a lead. This is my first Salesforce trigger, so there might be some basic steps I'm missing.. But I've saved the trigger in the Developer Console and it doesn't report any problems, yet creating a new ticket doesn't update the boolean.

Here's the trigger I'm running below. I've installed the Zendesk integration onto my Developer edition Salesforce, to the point that new tickets display on a lead's record. However when I have this trigger active and log a new ticket with a lead, it doesn't update the boolean.

Any help appreciated!
trigger UpdateCampaignResponse on Zendesk__Zendesk_Ticket__c (after insert) {
        for(Zendesk__Zendesk_Ticket__c ticket : Trigger.new) {

            // Check if ticket requester is a lead
            if(String.valueOf(ticket.Zendesk__Requester__c).startsWith('00Q')== True) {

                // Create a set, add ticket requester id
                set<id>leadId=new set<id>();

                // Lookup and assign lead based on set
                Lead lead=[Select CampaignResponse__c from Lead where id in :leadId];
                // Mark Campaign Response on lead
                update lead;