• Shauna Davies 72
  • NEWBIE
  • 10 Points
  • Member since 2018
  • Administratorq
  • Appian

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 10
    Replies
I need an Apex Trigger that will update and move a lead from our Content Syndication queue to the reassignment queue when a lead reaches >80%.  I cannot use a workflow, because that will only kick off on creation or edit, and the lead scoring tabulates by Einstein every hour.  Unless I do a mass update to edit/save and kick off the workflow, Salesforce help has said that an Apex Trigger is the only solution.

I have this code, but I get an error on line 5:  Error: Compile Error: Missing '<EOF>' at 'for' at line 5 column 5

trigger LeadRoutingTrigger on Lead (before update) {
    Group ReassignmentQueue = [select Id from Group where Type = 'Queue' AND NAME = 'Reassignment Queue' LIMIT 1];
    Group ContentQueue = [select Id from Group where Type = 'Queue' AND NAME = 'Content Syndication and Events Queue' LIMIT 1];
}
    for(Lead currentLead : Trigger.new) {
        if(currentLead.OwnerId == ContentQueue.Id 
           && currentLead.Lead_Insights_Value__c    > 80) {
               currentLead.OwnerId = ReassignmentQueue.Id;
           }
    }
}

Does anyone have a suggestion?  

Thanks
I have two lead queues:  
Reassignment Queue    00G00000006t3ZFEAY
Content Syndication and Events Queue    00G00000006skVdEAI

I am trying to write a trigger to evalute when a Lead is in the Content Syndication and Events que, and reaches >80%, it is reassigned to the Reassignment queue.

IF
(AND(NOT ISBLANK([Lead].Lead_Insights_Value__c ),
[Lead].Lead_Insights_Value__c   > 80,
[Lead].OwnerId = '00G00000006skVdEAI')
update [Lead].OwnerId = '00G00000006t3ZFEAY')

Is my syntax correct?
 
trigger UpdateAEContactActivities on Task (after update) {

set<ID> ContactIds= new Set<ID>();
for(Task tt:trigger.new){
if(UserInfo.getProfileId()=='Standard Sales User'){
    if(tt.Subject.containsIgnoreCase('Call (Completed)') || tt.Subject.containsIgnoreCase('Call (Left Message)') || tt.Subject.containsIgnoreCase('Call (No Answer)') || tt.Subject.containsIgnoreCase('Call (Incoming)') || tt.Subject.containsIgnoreCase('Email - &') || tt.Subject.containsIgnoreCase('LinkedIn') || tt.Subject.containsIgnoreCase('[Sendbloom]')){
        if(tt.Status.equals('Completed')){
            ContactIDs.add(tt.whoID);
        }
    }
}
}

if(ContactIds.isEmpty())
return;

 if(stoprecurssionupdate.runonce()){
List<Contact> cnts= new List<Contact>();
Integer number1=1;
for(Contact ct:[select id, name, AE_Activities_Counter__c  from Contact where id in:Contactids])
{

if(ct.AE_Activities_Counter__c ==null)
ct.AE_Activities_Counter__c=0;
ct.AE_Activities_Counter__c=ct.AE_Activities_Counter__c+number1;
cnts.add(ct);
}

if(cnts.size()>0)
{
update cnts;
}
}}

The code keeps returning an error on line 5...  I know I don't have the syntax correct....
I need an Apex Trigger that will update and move a lead from our Content Syndication queue to the reassignment queue when a lead reaches >80%.  I cannot use a workflow, because that will only kick off on creation or edit, and the lead scoring tabulates by Einstein every hour.  Unless I do a mass update to edit/save and kick off the workflow, Salesforce help has said that an Apex Trigger is the only solution.

I have this code, but I get an error on line 5:  Error: Compile Error: Missing '<EOF>' at 'for' at line 5 column 5

trigger LeadRoutingTrigger on Lead (before update) {
    Group ReassignmentQueue = [select Id from Group where Type = 'Queue' AND NAME = 'Reassignment Queue' LIMIT 1];
    Group ContentQueue = [select Id from Group where Type = 'Queue' AND NAME = 'Content Syndication and Events Queue' LIMIT 1];
}
    for(Lead currentLead : Trigger.new) {
        if(currentLead.OwnerId == ContentQueue.Id 
           && currentLead.Lead_Insights_Value__c    > 80) {
               currentLead.OwnerId = ReassignmentQueue.Id;
           }
    }
}

Does anyone have a suggestion?  

Thanks
I have two lead queues:  
Reassignment Queue    00G00000006t3ZFEAY
Content Syndication and Events Queue    00G00000006skVdEAI

I am trying to write a trigger to evalute when a Lead is in the Content Syndication and Events que, and reaches >80%, it is reassigned to the Reassignment queue.

IF
(AND(NOT ISBLANK([Lead].Lead_Insights_Value__c ),
[Lead].Lead_Insights_Value__c   > 80,
[Lead].OwnerId = '00G00000006skVdEAI')
update [Lead].OwnerId = '00G00000006t3ZFEAY')

Is my syntax correct?
 
trigger UpdateAEContactActivities on Task (after update) {

set<ID> ContactIds= new Set<ID>();
for(Task tt:trigger.new){
if(UserInfo.getProfileId()=='Standard Sales User'){
    if(tt.Subject.containsIgnoreCase('Call (Completed)') || tt.Subject.containsIgnoreCase('Call (Left Message)') || tt.Subject.containsIgnoreCase('Call (No Answer)') || tt.Subject.containsIgnoreCase('Call (Incoming)') || tt.Subject.containsIgnoreCase('Email - &') || tt.Subject.containsIgnoreCase('LinkedIn') || tt.Subject.containsIgnoreCase('[Sendbloom]')){
        if(tt.Status.equals('Completed')){
            ContactIDs.add(tt.whoID);
        }
    }
}
}

if(ContactIds.isEmpty())
return;

 if(stoprecurssionupdate.runonce()){
List<Contact> cnts= new List<Contact>();
Integer number1=1;
for(Contact ct:[select id, name, AE_Activities_Counter__c  from Contact where id in:Contactids])
{

if(ct.AE_Activities_Counter__c ==null)
ct.AE_Activities_Counter__c=0;
ct.AE_Activities_Counter__c=ct.AE_Activities_Counter__c+number1;
cnts.add(ct);
}

if(cnts.size()>0)
{
update cnts;
}
}}

The code keeps returning an error on line 5...  I know I don't have the syntax correct....