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
conorfinneganconorfinnegan 

Update Account Field with Task Notes (based on Subject)

Let me first say "thank you" in advance for any and all help given for my project here.  I'm a novice when it comes to apex code but I know what I want to do is possible.  

What I want to do
On the account object, I have a field called "Current_Status__c" where my reps can update information about their account for the week.  The problem with this is that I want to be able to have the history of each of these statuses, so I was thinking the best might be to "log a call" or use "new task" with the subject line of "Status Update".   The rep would fill out the "Comments" sections which Salesforce calls "Description" and then their information would automatically move to the "Current_Status__c" field on the account.  Each week the rep would "log a call" or use "new task" again and the "Current_Status__c" field would be overwritten with the latest information.  I already have a "status history" field that checks whenever "Current_Status__c" is changed and adds the latest info to the history field.  

What I need (ie. Everything)
  1. Should I use "log a call" and just make the subject "Status Update" or use "new task"?  Is there a benefit to either one?  
  2. The actual apex code on how to do this
  3. Test code
  4. Any other information on how to deploy this to production.  I can use the Sandbox.

I've found a couple other discussions that I could repurpose for my situation but I don't know how to write the test code and what I should use to actually deploy my code.  I'm willing to learn and piece things together if folks can point me in the right direction.  

Thanks again to all those willing and able to help.  I really appreciate it.  

Conor
Ankit Gupta@ DeveloperAnkit Gupta@ Developer
Hi Conor,

You can achieve this by standard functionality without write a line of apex code. Follow the below steps
  1. Create 1 custom object with master detail relationship of account object
  2. Create a field from which you want to update account status field
  3. Create a work flow on custom object and add event field update. Form that workflow you can update account (parent) object field.