8 Replies Latest reply on Jul 6, 2018 2:11 PM by Grégoire Michel

    How can I reassign leads based on autoassignment rules?

    Danielle Chan

      My marketo is integrated with SFDC. SFDC has the autoassignment rules set up and applies it to new leads.


      We made an exception for a certain campaign where leads that fill out Form A with Lead Tracking Code ABC123 will be assigned to Georgia. However, if this lead comes back and fills out Form B I want to reassign this lead based on our usual auto-assignment rules.


      How can I do this? I currently have this set up like the below but it's not changing the lead owner.. it's still Georgia. Thanks in advance for your help!


        • Re: How can I reassign leads based on autoassignment rules?
          Jackie Potts

          The auto assignment rules are the SFDC assignment rules from what I understand, so you would have to change the rules in SFDC to look for that form fill activity and have it reassign.

          • Re: How can I reassign leads based on autoassignment rules?
            Stephanie Kimball

            We are trying to solve a similar issue but from a different angle. We currently use the SFDC Lead Assignment Rules. To get the leads to run through the rules multiple times we use the Assign using active assignment rules checkbox. When that field is set to true, the lead runs through the assignment rules when there is any edit to the lead. These are settings in SF. This might begin to solve Danielle's issue. However, read on to see how this process affects assigning to an individual user.


            We are trying to implement a situation where we can assign an individual as the owner or assign to a queue depending on the situation. For example, Scenario 1: A lead coming in from a Contact Us runs through the rules and gets assigned to a queue; Scenario 2: Marketing is creating a campaign that targets a customer and wants all leads to be assigned to the user who is the account owner. What we see with our current set up: The lead gets the user as the owner, but the assignment rules change it to a queue it qualifies for. We don't want to create a SF assignment rule for the account manager scenario as this is short term and the SF IT cycle of design, build, test, deploy hampers us in being efficient and flexible getting a campaign up and running. Our first Lead Assignment Rule in SF states "If lead is in a Sales Accepted status meaning the Sales owner is now the owner and not the queue, then keep the same owner. The SF Admin has suggested we put the lead in the lead status of Sales Accepted in Marketo so it meets the criteria for that first rule. Marketing Ops is not keen on this idea as it puts the Acquisition Lifecycle steps outside of the current operational campaigns. I'm looking for any suggestions that would allow us to meet both scenarios without too much "human remembering" to be a part of the process, i.e., someone building a campaign doesn't need to remember to add this step and that step to assign to an individual other than what is intuitive in assigning an owner.


            • Re: How can I reassign leads based on autoassignment rules?
              Veronica Holmes

              Danielle - by default SFDC lead assignment rules only run on new leads - so once the lead exists and has been assigned it won't re-run.

              If you need to change the owner based on a condition, you'd need to use the Change Owner flow step in Marketo, or have some kind of Process Builder or workflow manage the change in Salesforce.

              • Re: How can I reassign leads based on autoassignment rules?
                Grégoire Michel

                Hi Danielle,


                Vote here: Force execution of Salesforce Lead Assignment Rules on lead update


                And here is the workaround:


                It takes a "Trigger_Assignement_Rules__c" field on the lead object. This field will be sync'ed to Marketo. Each time you check this field in Marketo, the trigger will fire in SFDC.

                trigger triggerassignmentrules on Lead (after insert, after update) {

                    system.debug('Starting triggerassignmentrules trigger');

                    List<Lead> leadstoUpdate = new List<Lead>();

                    For (lead thelead:trigger.new){

                        if (thelead.Trigger_Assignement_Rules__c == true) {

                            system.debug('Triggerassignmentrules trigger - Processing trigger:'+thelead.lastname+'-'+thelead.id);

                            Database.DMLOptions dmo = new Database.DMLOptions();

                            dmo.assignmentRuleHeader.useDefaultRule = true;


                            system.debug('*******Error:  ');

                            Lead Lead2 = new Lead (id=thelead.id, Trigger_Assignement_Rules__c = false );





                    if(!leadstoUpdate.isEmpty()) {

                        update leadstoUpdate;




                TEXT CLASS :


                public class TriggerAssignmentRuleTest {

                  public static testMethod void UnitTest() {




                        Lead TestLead = new Lead(LastName='Test1',Industry='Automotive', Company='ACME', Status='COL-Cold Leads', Trigger_Assignement_Rules__c = True);

                        insert TestLead;

                        TestLead.Status='CRL-Conversation Ready Lead';

                        TestLead.Trigger_Assignement_Rules__c = True;

                        update TestLead;





                3 of 3 people found this helpful
                • Re: How can I reassign leads based on autoassignment rules?
                  Courtney Grimes

                  While Greg's method works, I'd recommend as an alternative to look at the Process Builder Blocks package, which will allow you to do the same thing but allow it to be invoked by Process Builder rather than by checkbox.

                  1 of 1 people found this helpful