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
Jessie WheelerJessie Wheeler 

Updating Opportunity Fields from Task & Event Fields

We created a custom field on both the Opportunity and Activities called "Next Step" <-- Long Text

I'd like to update the NEXT STEP on the OPPORTUNITY anytime an activity (Event or Task) contains a next step (or is subequently updated).




Jason Curtis NBSFDGJason Curtis NBSFDG
What type of data do you want to populate in "Next Step" when an activity is updated? Is it copying something over from the activity?
Jessie WheelerJessie Wheeler
Hi Jason -

It is copying the text from the Next Step in the activity - to the Next Step text field on the Opportunity:

Activity API:  Next_Step_c (Text area 255)
Opportunity API: Next_Step__c (Long text)
Jason Curtis NBSFDGJason Curtis NBSFDG
Populating a parent record (Opportunity) from a child record (Activity) will require an Apex trigger on the activity.
Here is another reference: https://success.salesforce.com/answers?id=90630000000glwDAAQ

You also might be able to use a flow but I haven't tired that yet (could get tricky because of the way an activity is related to opportunities).

Hope this helps.
Jessie WheelerJessie Wheeler
Hi Jason - The link you provided did not provide a solution, but a suggesstion of using a trigger. I know the right way is to go about using a trigger - but I am looking for potentially a step by step or an example of one that was used to accomplish this. Anything else you could provide would be greatly appreciated.
Pete HicksPete Hicks
Jessie,

I was inspired by your post.  Hopefully solved this problem.  If not let me know.  We got our triggers wired up to do this in a days worth of work.  Let me know if you still need it.

Pete
Nicole Chang_Nicole Chang_
Hey guys,

Do you know if the problem is solved yet? I'd love to know as I am looking for something quite the same as Jessie's post. 

Thank you & any best practices are much appreciated.