• mms16
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies

We have a trigger that automatically re-runs assignment rules for any leads that meet certain critereon and and put into a specific queue. It's a trigger on the lead object, and it works great when I assign a lead to the queue in the UI, or it I do it in batches of 9 or smaller via demandtools etc. However, any time leads are bulk updated by Marketo (scoring etc) or if I try and perform bulk updates via DemandTools or DataLoader I get the error:

"Developer script exception from TRUSTe : reassignAutoQueue : reassignAutoQueue: execution of AfterUpdate caused by: System.AsyncException: Future method cannot be called from a future or batch method: AssignLeads.assign(LIST<Id>) Trigger.reassignAutoQueue: line 31, column 1"

Here is the fulltext of the error email:
Apex script unhandled trigger exception by user/organization: 005E000000XXXX/00DE0000000XXXX
reassignAutoQueue: execution of AfterUpdate
caused by: System.AsyncException: Future method cannot be called from a future or batch method: AssignLeads.assign(LIST<Id>)
Trigger.reassignAutoQueue: line 31, column 1


My trigger is below (it's primative, but I am a beginner and only starting to learn APEX so please forgive the poor coding). I can easily do small batch updates via demandtools, but I can't via Marketo. Is there any way I can prevent this trigger from running if the active user is Marketo (we don't want it to run for Marketo updates anyway)? Any help is greatly appreciated, thank in advance.

-Matt Stryker

trigger reassignAutoQueue on Lead (after update){

List<Id> lIds=new List<id>();

For (lead l:trigger.new){

Decimal checkrun=0;

if(l.Round_Robin_East_ID__c<>NULL)
checkrun=(checkrun+1);

if(l.Round_Robin_West_ID__c<>NULL)
checkrun=(checkrun+1);

if(l.Round_Robin_APAC_ID__c<>NULL)
checkrun=(checkrun+1);

if(l.Round_Robin_EMEA_ID__c<>NULL)
checkrun=(checkrun+1);

if (l.IsConverted==True)
checkrun=0;

if (l.OwnerID<>'00GE0000001buSm')
checkrun=0;

if (checkrun>0){
lIds.add(l.Id);
}
}
if (AssignLeads.assignAlreadyCalled()==FALSE){
system.debug('Assign already called? '+AssignLeads.assignAlreadyCalled());
AssignLeads.Assign(lIds);
}
}

  • December 03, 2013
  • Like
  • 0

We have a trigger that automatically re-runs assignment rules for any leads that meet certain critereon and and put into a specific queue. It's a trigger on the lead object, and it works great when I assign a lead to the queue in the UI, or it I do it in batches of 9 or smaller via demandtools etc. However, any time leads are bulk updated by Marketo (scoring etc) or if I try and perform bulk updates via DemandTools or DataLoader I get the error:

"Developer script exception from TRUSTe : reassignAutoQueue : reassignAutoQueue: execution of AfterUpdate caused by: System.AsyncException: Future method cannot be called from a future or batch method: AssignLeads.assign(LIST<Id>) Trigger.reassignAutoQueue: line 31, column 1"

Here is the fulltext of the error email:
Apex script unhandled trigger exception by user/organization: 005E000000XXXX/00DE0000000XXXX
reassignAutoQueue: execution of AfterUpdate
caused by: System.AsyncException: Future method cannot be called from a future or batch method: AssignLeads.assign(LIST<Id>)
Trigger.reassignAutoQueue: line 31, column 1


My trigger is below (it's primative, but I am a beginner and only starting to learn APEX so please forgive the poor coding). I can easily do small batch updates via demandtools, but I can't via Marketo. Is there any way I can prevent this trigger from running if the active user is Marketo (we don't want it to run for Marketo updates anyway)? Any help is greatly appreciated, thank in advance.

-Matt Stryker

trigger reassignAutoQueue on Lead (after update){

List<Id> lIds=new List<id>();

For (lead l:trigger.new){

Decimal checkrun=0;

if(l.Round_Robin_East_ID__c<>NULL)
checkrun=(checkrun+1);

if(l.Round_Robin_West_ID__c<>NULL)
checkrun=(checkrun+1);

if(l.Round_Robin_APAC_ID__c<>NULL)
checkrun=(checkrun+1);

if(l.Round_Robin_EMEA_ID__c<>NULL)
checkrun=(checkrun+1);

if (l.IsConverted==True)
checkrun=0;

if (l.OwnerID<>'00GE0000001buSm')
checkrun=0;

if (checkrun>0){
lIds.add(l.Id);
}
}
if (AssignLeads.assignAlreadyCalled()==FALSE){
system.debug('Assign already called? '+AssignLeads.assignAlreadyCalled());
AssignLeads.Assign(lIds);
}
}

  • December 03, 2013
  • Like
  • 0

Anyone know what the field name is used to store the sort order for quote line items?

The equivalent for opp line items is called "SortOrder"

 

I want to query and order by this field....

 

thanks in advance,

dale

  • March 23, 2012
  • Like
  • 0

Hi,

  I have to create custom fields to show the Last activity date and Number of activities for a lead in the lead detail section.

How can I do that? Is it possible to show this information in Lead?

Thanks and looking forward for an answer.

  • April 11, 2011
  • Like
  • 0

Does anyone have any Apex code (or ideas) that could be run prior to the web-to-lead assignment rules that would: 

 

- Query for any accounts of the same name as the "Company Name" field in the lead  

 

- Determine if it is a "named" account based on an account field 

 

- Assign the lead to the account owner OR another designated user based on the account owner (like inside sales)

 

This would be really helpful for us in situations where we have named accounts that are outside the normal lead / territory assignments.  

 

Thanks for any code, help or ideas!

  • February 09, 2010
  • Like
  • 0