+ Start a Discussion

Custom activities field pulling info from a related opportunity?

I've been banging my head on the desk all morning trying to do this, and before I decide there isn't a way, please let me know if I just missed something painfully obvious. Our organization sells classes as our opportunities. In our opportunity section, we have a custom formula field, "Training_Address_Info" which fills in the field from info in the account related to the opportunity. Once the opportunity - the class - is sold, we have to schedule an instructor for it, so we create an event for the instructor, which is related to the opportunity. I'm trying to create a custom activity forumla field which will pick up the "Training_Address_Info" field from that opportunity. There are actually a few fields I'd like to reference from the related opportunity, but there doesn't seem to be a way to create that relationship between the event and opportunity - but I'm still learning lots regularly, so maybe I just haven't figured it out yet? (Apologies for any awkward wording, I'm also still trying to master the lingo!)

What kind of report are you using as your starting point?   

If you use an "Activities with Opportunities Report" you should have full access to the complete Event, Account, and Opportunity records including all standard and custom fields.  

Message Edited by Stevemo on 09-10-2009 01:51 PM
Whoops! my bad, I misread your post and thought that you were looking to pull the information into a report, not a custom formula field (I guess there must be some truth to those cautionary tales about Mushrooms...)
Message Edited by Stevemo on 09-10-2009 02:05 PM

we are having the same issue (inability to pull in account fields to a custom activity field).  this is frustrating.  nor are we able to pull account fields into an activity view... though that is the same for most all of the object views.... but the workaround is to create a custom field on the object you are creating the view for and have that custom field pull its value from the account or other related object.  but, this doesnt seem possible with activity custom fields (as it is with cases, for example).  i just submitted this case to support this morning:


"We would like to modify several of our activity views to include information from the account record that the activity is associated with.  For example, if we have an activity view showing all "setup demo" tasks, we want that view to include a column for "account service plan".  however, it seems there is no way to add account fields to an activity view.  We encountered this same issue with cases but were able to implement a workaround.  All of the account fields that we wanted visible on a case (or in a case view) we created a custom counterpart field for on the case object.  These custom case fields are formulas that produce text strings.  The formula simply takes the value from the field on the account that is associated with the case.  We thought we would try this method for activities, too.  However, when creating an activity custom formula field, there is no option to insert any account fields.

please advise.  thank you."

Hope they're able to give you a solution (and if they do, you will share it)! I'm somewhat relieved to hear it's not just me, though.
Were you able to get a solution to this issue?  I want to do something similar, pull the Contact address into the Event location field.

For all of those interested, here's how my dialog went with SF support (in short: no resolution or workaround):


 9/22/2009 2:16 PM | Robert Gelarden
Called Colin Murphy, explained that I was not able to find a way to put the Account fields onto the Activity.
 9/21/2009 6:02 PM | Robert Gelarden
Dear Colin, 

This email is follow up to case 02938697. I have not yet found a way to display the Account fields in an Activity list view. I will contact you as soon as I have an update. 

Please feel free to contact Customer Support if you have any additional questions. 

Thank you, 
Robert Gelarden 
 9/18/2009 10:52 AM | Robert Gelarden
Called Colin Murphy, 

The Activity custom formula fields cannot display Account fields since Accounts are connected to the Activity through the Related To field. I suggested using an Activities with Accounts report, this is not suitable as the Users need a task view displayed in the Console. 

I will look for something that will display an Account field on Tasks.



This is a less than perfect solution, but it might help you guys out.  


If you are using the Console Tab on your SFDC you can create a Console that displays a List of Account Activities at the top, and Task and Account Detail windows side-by-side on the bottom (you can also do this for Tasks and Opportunities).  


First create a custom Activity field Formula(Number,0)


Use a formula like this to identify that the Activity is related to an Account, Opportunity, etc.


IF(LEFT(WhatId,3) = "001",1,0)


*** note for Opportunities substitute "006"  


 Then create a custom Activity List View for your Console that only displays Account Activities, Opportunity Activities, etc.  


Hope this helps 



I was hoping to be able to populate a field with the account/contact address/phone.  Not for report purposes, but so I could map that field to my lotus notes connector so my users could create an event in SF and when synching into Lotus Notes the address and phone number would show. 

I'm not exactly sure how it would work if your event is on the Opportunity, but you can reference Account fields in activity custom fields.  They're just not available on the formula editor.  For example, we have a custom field on the Event called Account Address that has a formula of Account.BillingStreet and that successfully pulls in the related Account Billing Street.
Emelie ÖstEmelie Öst

I have the same issue still, did anyone find a solution?

I want to see the stage of the related opportunity in my activity, simply putting in "opportunity.stage" doesn't work. I can create formula fields referencing the account, strange it's not possible from the opportunity as well...

Jay RaineyJay Rainey
Emelie - I'm in the same boat as you looking for the same functionality.
Hayley Johnston 14Hayley Johnston 14
I am having the exact same issue.  I can't find anything helpful online  
Evan McHughEvan McHugh
This is possible with process builder and flows. If these tools are new to you, I strongly suggest you check out this article (https://salesforcesidekick.com/2015/12/21/match-leads-to-an-account-automatically-with-an-account-number/).

This process basically looks at the WhatId (Related To) or WhoId (Name/ Lead or Contact) to pull the Account Id, and then pastes that Id into a separate account lookup field on the activity. Once the activity has the account lookup field populated you can create formula fields. NOTE: I have an account lookup field on the lead object which gets auto filled per the article linked above

1. Create a custom lookup field on the activity to the Account Object

2. Create your flow. in each record lookup you are looking for the lead, contact, or account referenced in the WhatId and WhoId fields, and storing the Account Id in an empty variable. You then do a record update on the specific task and populate the custom lookup field from step 1 with the Id that you stored in the record lookup:
User-added image

3. Save and Acticate the flow. This is a "headless flow" which means it won't do anything until you launch it with process builder.

4. Build a process. The process basically is the start point. You pick an object to launch some action, set optional criteria for doing the action, and finally define the action. So in this case, start with the task object (created and edited), criteria should be "custom account lookup field is blank", and in the action, you're running the flow you created above.
User-added image
When you select the action, this is where you define the variables you created in the flow (read the article above to understand that stuff)
User-added image
5. Activate the Process. Test a few records/scenarios. Then you can pull a list of existing task ids and run them through data loader to back load the account lookup. going forward as tasks are created, the field should pull the value

If the task is related to an opportunity you basically just need to add to your flow a decision (does the "related to" field start with 006) and if so lookup that opp record and store the account Id
@adam1.3896553289585686E12 did post a simple solution in this very thread. I am amazed that no one noticed. It works, too.
Anne Brock 6Anne Brock 6
Adam1's solution works for Account, but doesn't seem to work for Opportunity. I get "Field Opportunity does not exist". Anyone get it working for Opportunity fields without need to use Process Builder?
Global PartnershipsGlobal Partnerships
Evan's solution works quite well actually! Just need to pull the relevant fields into your field updates via the Flow builder