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
PseudodarwinistPseudodarwinist 

Issue with a formula field

WHAT: In my Account object when a field "GDPR flag" gets checked,it should automatically fill the "GDPR date" field to be te same date(date on which the flag chcekbox  gets checked).
So we are using the formula field: IF( R2_ACC_CHK_GDPR_UnSub__c , TODAY() , NULL).
ISSUE: Because of this formula field, the "GDPR date"is getting changed everyday to the current day, which is wrong.It should reflect the day when the checkbox was checked and should stay always the same date.i.e if we marked any customer as GDPR on 09th Sept 2018, tomorrow or one year from now , the date should always reflect 09th sept 2018.
How can i achieve that? Can i make some changes in formula field?or can i do it in the triger code?Please help.I am novice so would require your explanation as well.
 
Best Answer chosen by Pseudodarwinist
v varaprasadv varaprasad
Hi Chetan,

Use Workflow : 

create a workflow on the object and set the evaluation criteria to
Evaluate the rule when a record is created, and any time it's edited to subsequently meet criteria (3rd option)

Rule criteria: 
GDPR flag = True

Action: field update : 

R2_ACC_CHK_GDPR_UnSub__c =  TODAY()



Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.

Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
Blog: http://salesforceprasad.blogspot.com/

Salesforce latest interview questions  :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1

All Answers

v varaprasadv varaprasad
Hi Chetan,

Use Workflow : 

create a workflow on the object and set the evaluation criteria to
Evaluate the rule when a record is created, and any time it's edited to subsequently meet criteria (3rd option)

Rule criteria: 
GDPR flag = True

Action: field update : 

R2_ACC_CHK_GDPR_UnSub__c =  TODAY()



Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.

Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
Blog: http://salesforceprasad.blogspot.com/

Salesforce latest interview questions  :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1
This was selected as the best answer
PseudodarwinistPseudodarwinist
Thanks varaprasad.So i was trying your recommendations as: 
Rule criteria: 
R2_ACC_CHK_GDPR_UnSub__c = True
Action: field update : 
R2_ACC_FOR_Date_GDPR__c=  TODAY()
but it seems since R2_ACC_FOR_Date_GDPR__c is a formula field ,i am not able to find it in "Field to update". Do i need to delete it first and just create a date field?or you have some other suggestion?
PseudodarwinistPseudodarwinist
User-added image

I am getting the above error"Error: Incorrect parameter type for operator '='. Expected Boolean, received Date"