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
Abhijeet Purohit01Abhijeet Purohit01 

Problem in workflow

I am writing a workflow which should trigger an email when following conditions are satisfied:

 

Status of a picklist field is not changed for 7days OR value of the text field is not changed for 7days.

 

This is the formula that I have framed:

 

AND( NOT(ISCHANGED(Brand__c)),  NOT(ISCHANGED(Comment__c)),  IF((Last_Field_Change__c =Last_Field_Change__c+7),TRUE,FALSE ))

 

Here, Brand__c is a picklist field, Comment__c is a text field and Last_Field_Change__c is a date/time field which stores LastModified Date/Time of Brand__c or Comment__c.

 

Can anybody help me?

Best Answer chosen by Admin (Salesforce Developers) 
phiberoptikphiberoptik
AND(

          NOT(ISCHANGED(Brand__c)),  

          NOT(ISCHANGED(Comment__c)),

          Last_Field_Change__c = TODAY() - 7

         )

 Give this a try. It should fire the workflow if neither field has changed and the last field change date is 7 days ago.

All Answers

phiberoptikphiberoptik
AND(

          NOT(ISCHANGED(Brand__c)),  

          NOT(ISCHANGED(Comment__c)),

          Last_Field_Change__c = TODAY() - 7

         )

 Give this a try. It should fire the workflow if neither field has changed and the last field change date is 7 days ago.

This was selected as the best answer
Abhijeet Purohit01Abhijeet Purohit01

I will let you know tomorrow as I have used

 

 

Last_Field_Change__c = Now() - 1

 

 

Thanks. 

Abhijeet Purohit01Abhijeet Purohit01

Sorry for the late reply. It was not working so was stuck in that.

Actually I created 2 workflow rules:

 

1st workflow: To find the last field change date/time.

Rule Criteria: If(IsChanged(Brand__c)||IsChanged(Comment__c))

Action: Field update: Last_Field_Change__c.

 

2nd Workflow: To send an email if the fields Brand__c and Comment__c is not changed since 7days!

Rule Criteria: If(CreatedDate+7<=NOW() && IsNull(Last_Field_Change__c)) || (Last_Field_Change__c +7<= NOW())

Action: Send an email.

 

Here, Brand__c is a picklist, Comment__c is a text field and Last_Field_Change__c is a Date/Time field.

 

Its not working.

phiberoptikphiberoptik

So does workflow rule 1 work correctly? Does the Last Field Change field update correctly based on Brand or Comment being edited? Also, for rule 1, what is the Evaluation Criteria?

 

Why would you be using CreatedDate in the second workflow rule? Since your Last Field Change field updates whenever one of the two fields is edited, all you need to trigger the workflow 2 as the Run Criteria is:

 

Last_Field_Change__c +7 = NOW()

 

This will fire the email if the Last Field Change date/time value is 7 days ago. You do not need to use <=.

Abhijeet Purohit01Abhijeet Purohit01

Yes. Workflow Rule 1 works correctly. I used CreatedDate in Workflow Rule 2 thinking that if a record is created and Brand__c OR Comment__c field value is not changed for the past 7 days then an email will never be sent coz for a new record the Last_Field_Change__c will be null. 

phiberoptikphiberoptik

Please try my previous reply and let me know if it works for you.