3

I've set up a workflow rule on the Contact object to change a picklist value if it's blank and the Contact owner is a certain role. However, when a lead is converted, the workflow rule doesn't fire.

I've tried toggling on and off the "Require Validation for Converted Leads" lead setting, but it doesn't seem to help.

Here's the formula for the workflow:

AND(
   Owner.UserRole.Name = "SDR",
   ISBLANK( 
      TEXT(SDR_Active_Status__c) 
   )
)

And the action taken is a Field Update to make SDR_Active_Status__c = "Open" -- this update action re-evaluates workflows after completion.

The SDR_Active_Status__c field is mapped to the same picklist at the lead level and seems to be the point of error. Even when the field isn't filled out at the lead level, the formula seems to fail at that part after conversion.

Any ideas why this would not work?

EDIT

Upon further investigation, I found that the workflows are firing, but the Owner criteria is causing it not to trigger properly.

For example, I modified my original trigger above to be this:

ISBLANK(TEXT(SDR_Active_Status__c))

And it works properly upon lead conversion. However, when that workflow fires, it updates a field and re-evaluates workflows, which should then trigger this workflow:

AND(
       ISPICKVAL(SDR_Active_Status__c, "Open"),
       OR(
          SDR_Status_Open_Date_Day__c = "Friday",
          SDR_Status_Open_Date_Day__c = "Saturday"
       ),
       OR(
          Owner.Alias = "rrein",
          Owner.Alias = "ahans",
          Owner.Alias = "sconn"
       )
    )

But that doesn't work. I tried modifying it to use the Owner.UserRole.Name = "SDR" criteria, and also tried creating a formula field that copies the role to the Contact object, but nothing worked.

If I remove any reference to the Contact owner, the workflow DOES work. Any ideas why the references to the Owner of the record would cause the workflow to not run?

  • Did you look at the debug log to see more about the workflow rule invocation and arguments passed to the workflow criteria? – cropredy Feb 13 '16 at 23:52
  • 2
    Owner is the current user until after the conversion is complete. I ran in to this problem once. You'll need a @future method to update the record immediately after conversion. – sfdcfox Feb 14 '16 at 0:35
  • 1
    @Matt Yes, the lead owner is set after the lead conversion entirely-- during the conversion, the owner will be the user performing the conversion. You need to wait asynchronously to do anything based on owner/owner role. – sfdcfox Feb 14 '16 at 1:40
  • 1
    @Matt Yes, if the user is allowed to change the ownership during conversion, you still won't know who the new owner is until post-conversion. I suppose you could write a custom Visualforce page to override the default conversion process, in which case you'd know the new owner in advance... and then you could do whatever you wanted. I still say that a future method would simply be easier, but it's entirely up to you. – sfdcfox Feb 14 '16 at 2:14
  • 1
    @Matt As I said, the entire lead conversion process doesn't set the owner correctly until after conversion. Either Visualforce to control the conversion process, or a future method to do the update afterwards. A simple workflow won't help, and a simple trigger won't help. – sfdcfox Feb 14 '16 at 2:44
2

@Matt - I think one thing you can try is to add a email alert to the same workflow and include the Owner Name in the email just for the debugging purpose. That would tell you who was the owner of the record when the Workflow rule fired. Though this is not the solution to your problem, might help in debugging further.

0

I wound up using @sfdcfox's suggestion of a @future method. My new process is: a simple trigger fires on Lead after update in which it checks for the lead conversion -- then it calls a @future class which updates a checkbox on the new contact.

By doing it this way, the checkbox is updated after the conversion is completed, so the change of ownership is also finalized. Now my workflow looks to make sure the checkbox is TRUE and my owner criteria is met before it goes to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.