0

I have the following validation rule that is supposed to stop user if the opportunity was created after a specific date and there is no leadsource value.

( 
ISBLANK(TEXT(LeadSource)) 
&& 
DATEVALUE(CreatedDate) > DATE(2017,12,12) 
)

This validation rule works perfectly when an opportunity is created from scratch or when it is edited and the leadsource value was manually change to manual.

However, when someone click on button clone and change the leadsource value to null, the validation rule doesnt work and it allows to save the record, this shouldnt be happening, it should be stopped as if it was an insert from scratch.

I am wondering why? what is wrong in cloning that is not in the scratch insert?

I am using the standard clone button, but the idea is to have a custom one that on click it clears the value of the leadsource,as this can change when they clone an opp, this way we have a bit more of leadsource true value in it.

1

Add logic:

( 
ISBLANK(TEXT(LeadSource)) 
&& 
(
DATEVALUE(CreatedDate) > DATE(2017,12,12) 
||
ISNEW() 
|| 
ISCLONE()
)
)

which will allow the validation rule to evaluate on the cloned record, which doesn't have a created date.

I realize that this looks like overkill, but it's a start and you can remove the date/newness piece by piece until you find the minimal required pieces.

1
  • Thank you, that worked, but I still dont understand why the original worked when creating from scratch, as cloning they shouldnt have a createddate, right?
    – manza
    Feb 22 '18 at 3:20

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.