3

I'm trying to ensure that there is atleast some activity on a lead before it is converted. I've tried setting a validation rule

ISCONVERTED && ISBLANK(LASTACTIVITYDATE)

but it returns as a validation error regardless of if the date is populated or not

Even if I try without the converted check the rule works just on saving but fails on conversion.

Please help

2

As per the description of LastActivityDate from salesforce documentation:

Value is one of the following, whichever is the most recent: Due date of the most recent event logged against the record. Due date of the most recently closed task associated with the record.

I believe what is happening is that the LastActivityDate is emptied everytime a lead is converted. On conversion, the activities created on the lead previously are transferred to the contact created on lead conversion. Hence everytime you convert a lead, it does not have any related tasks anymore and the LastActivityDate is set to null. I checked the value of the LastActivityDate for a converted lead from the back end before and after conversion.

0

This looks like a bug if you ask me.

Queried from my org (Id values redacted to protect the innocent):

SELECT Id, LastActivityDate FROM Lead WHERE Id = '00QXXXXXXXXXXXX'

Output:

Id               LastActivityDate
00QXXXXXXXXXXXX  2016-04-04

Attempting to convert puts this in my debug logs (maximum logging):

13:10:14.289 (2715429390)|VALIDATION_RULE|03dXXXXXXXXXXXX|ConvertOnlyWithActivity
13:10:14.289 (2715509591)|VALIDATION_FORMULA|IsNull(LastActivityDate)|LastActivityDate=null
13:10:14.289 (2715518831)|VALIDATION_FAIL

As you can see, the conversion is telling me that LastActivityDate is null when it's clearly not.

You should contact support, verify the behavior, and get a bug logged.

  • isn't this because the activities are deleted first (transferred to contact) when converting? – Fred Apr 5 '16 at 3:50
  • @Fred That's what I thought, too, but I found an old post from 2012 where someone used a nearly identical formula (using LastActivityDate to block lead conversion without activity), and it was apparently working then. Either way, I think we need to have salesforce.com verify if this is the intended behavior. The last I recall, task triggers ran sometime after lead validation rules occurred, so there should be a LastActivityDate at the point where the validation rules run. – sfdcfox Apr 5 '16 at 16:40
  • Can you folks confirm if this is a bug? Or should I go ahead and contact Support? – goabhigo Oct 12 '17 at 4:27
0

If you are converting Leads and you wanted to enforce the Validation Rule, you need to enable "Require validation for Converted Leads" from here

To enable the "Require validation for Converted Leads"

  • Go to your Name | Set-up | Customize | Leads | Settings
  • Enable
  • "Require validation for Converted Leads" Click on Save.

Also, try this ISCONVERTED &&ISNULL(LASTACTIVITYDATE)

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.