2

I Created a validation rule on Lead to not select inactive Account while conversion, here is the validation rule that throws the error

AND(IsConverted = True,
ISPICKVAL(Account_Status__c,"Inactive"))'

This works perfectly if I select an inactive account, validation error is thrown, if I select active account, the lead is converted. The problem comes during the lead conversion to new account, even if the status of the account is set to default status Active, when I try to create a new Account through lead conversion, it still throws the validation error. Why is this behavior happening?

Validation error on Lead. The status of the Account you have selected is Inactive. Please select an Active Account for Lead Conversion.

Validation error on Lead.

  • is this AccountStatus available for user running profile default account record type ? – Oleksandr Berehovskyi Nov 20 '17 at 19:32
0

I think we're missing information here -

As far as I can see, the validation rules checks the lead's IsConverted property as well its Account_Status__c BUT, not the account's actual status. What this means is that the lead's Account_Status__c is being filled in by a Process or a Trigger at some point.

If the Account_Status__c property of the lead is being filled in in a trigger/process, then you will never have the proper value in the lead before the validation rule is checked. Take into account execution order in the Force.com platform.

Now, giving a solution to your issue... I think the best way to address it would probably be by setting the Account_Status__c to Active before converting, if that's what it should be at the end of the transaction, or simply creating the account before converting. If you want a more customised experience, then feel free to develop something with Visualforce/Lightning Components.

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.