Answers.Body: <p>I finally made this work by applying a modified version of the patch at <a href="https://issues.civicrm.org/jira/browse/CRM-9649" rel="nofollow">https://issues.civicrm.org/jira/browse/CRM-9649</a> which adds an additional array of the previous values for all the custom fields to the hook_civicrm_custom hook.</p>
  
  <p>There is also a plan to make the _pre and _post hooks consistent by including custom data fields (see <a href="https://issues.civicrm.org/jira/browse/CRM-15261" rel="nofollow">https://issues.civicrm.org/jira/browse/CRM-15261</a>). This will also solve the issue I had when done.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-26T16:33:13.173Z
Answers.LastActivityDate: 2016-01-26T16:33:13.173Z
Answers.UserDisplayName: Piyush
Answers.Body: <p>I am not sure if it can already do exactly what you want, but my advice is to first look at the CiviRules extension.</p>
  
  <p><a href="https://civicrm.org/extensions/civirules" rel="nofollow">https://civicrm.org/extensions/civirules</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-23T21:22:16.450Z
Answers.Text: Catorghans, I just wanted to say thanks for the all answers you've been contributing lately! Much appreciated. Cheers, Joe
Answers.UserDisplayName: Joe Murray
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-26T16:28:03.193Z
Answers.Text: Thanks for the suggestion. Yes, I had looked at CiviRules but found it didn't quite work as I needed. It works with the _post hook as a trigger. However I found another way to make this work. See below in the answers.
Answers.UserDisplayName: Piyush
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-21T20:29:43.477Z
Answers.LastActivityDate: 2016-01-23T21:21:30.247Z
Answers.LastEditDate: 2016-01-23T21:21:30.247Z
Answers.UserDisplayName: Catorghans
Body: <p>How would you recommend to check data change (with pre and post values) on a custom field (attached to a case) and then to mark an activity in that case as completed? </p>
  
  <p>I have looked at hooks like hook_civicrm_custom and the _pre/_post hooks, but having difficulty getting this to work. </p>
  
  <p>Thank you!</p>
  
Tags: <custom-fields><civicase><activities>
Title: Check custom data field value change to trigger activity status change
ThreadText: # Check custom data field value change to trigger activity status change
  
  (Asked by: username_0 on 2016-01-21)
  
  How would you recommend to check data change (with pre and post values) on a custom field (attached to a case) and then to mark an activity in that case as completed?
  
  I have looked at hooks like hook\_civicrm\_custom and the \_pre/\_post hooks, but having difficulty getting this to work.
  
  Thank you!
  
  **Tags:** custom-fields, civicase, activities
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2016-01-26. Score: 2 | Accepted answer
  
  I finally made this work by applying a modified version of the patch at <https://issues.civicrm.org/jira/browse/CRM-9649> which adds an additional array of the previous values for all the custom fields to the hook\_civicrm\_custom hook.
  
  There is also a plan to make the \_pre and \_post hooks consistent by including custom data fields (see <https://issues.civicrm.org/jira/browse/CRM-15261>). This will also solve the issue I had when done.
  
  
  ---
  
  ### Answer by username_1 on 2016-01-21. Score: 3
  
  I am not sure if it can already do exactly what you want, but my advice is to first look at the CiviRules extension.
  
  <https://civicrm.org/extensions/civirules>
  
  > **Comments:**
  > **username_2**: username_1, I just wanted to say thanks for the all answers you've been contributing lately! Much appreciated. Cheers, Joe  
  > **username_0**: Thanks for the suggestion. Yes, I had looked at CiviRules but found it didn't quite work as I needed. It works with the _post hook as a trigger. However I found another way to make this work. See below in the answers.  
  
  ---
  
  