function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Help in WFR

Iam trying to calculate the age of lead between 2 owners, so here is what iam doing


1) I created Date field X

2) I created WFR with criteria ISCHANGED(OwnerId) then field update X = Now()

3) I created other Formula field  Y with data type Number .

4) I created WFR and iam trying to enter criteria such that



but iam getting error here, any idea what this should be , on the 4th step iam comparing the current owner should not be equal to previous owner so i can update the number field Y with NOw() - X


I can explain it clearly if any confusions .





hi  ISCHANGED gives true or false based on if the field value has changed and PRIORVALUE return previous field value.

I suggest check the ISCHANGED is true/false, if its true update the field  Y if its false you dnt have to do anything.


hope this helps.





Thx VJ, in the field update my formula was Now() - X


but the error says Expected DateTime received Date even i tried by Now() -DATEVALUE( X)



Steve :-/Steve :-/

What bis the Datatype of each field involved in your Formula?



     I had just one formula field "Y"and it's number data type according to step 3 in my post


All iam concerned is to calculate the lead age between owners because the owners keeps on changing

Steve :-/Steve :-/

but what are the Datatypes of all the other fields?  are they Date, DateTime?


I have just onefield  " X" of data type Date

Steve :-/Steve :-/

Try using 




That worked so here is what i have


1) First WFR criteria is ISCHANGED(OwnerId) then field update "X "= Today()

2) Second WFR criteris is ISCHANGED(OwnerId) then field upate "Y" = Today() - X


Does this works to calcuate the lead age between 2 owners ?




This will not help you find the age between 2 owners,  you will need to have some date as check point to find difference between date and time .


You are correct, but how many check points would we create, because there might be 5owners or more for lead that keep on changing,so everytime when the owner change would we create a checkpoint, i don't exactly find a way to do this




What is the requirement,

find the age of lead when the lead owner changes from owner1 to another owner2.

if above is the requirment, we can find the age of lead for Owner1 assuming the  createdate - lastupdatedate.

but how will you find the date/time when the owner is changes from owner1 to owner2.


i understand its tough requirement.


better display the age of the lead :):)


hope you find some solution.




Yes just neglect the time here, iam not concerned about the time, first when the lead is created i stored the date in one field "X" and next if the owner is changed i created WFR and on field update i said today() - "X" and i stored this days difference in one field "Y"which gives me the correct days but what if the owner changes again , do we create a WFR again and say Today() - Y, i mean we can't keep on creating , i guess there should be some way ..




Try it out as below:


Field X : stores CreateDate


Create :

1 st WF Rule: ISCHANGED(OwnerId) , and Action: Update Field X with DATEVALUE(NOW())


2 nd WF Rule:NOT(ISCHANGED(Field:X)) and Action Update Field Lead Age: PRIORVAULE(Field : X) - TODAY()


so when ever the owner field is changed, Field X will be updated and Lead Age will always have difference of previously value of Field X - today which will be updated when ever owner is changed.



Hope this helps :)


well i guess this deosn't work :( because


1) if the owner is changed the i need to calculate the the days from previous owner but according to you it just displays todays date

2) The field X according to you is nothing but it's always going to be todays date because the owner keeps on changing so there is no field age lead