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
Carlos McEwanCarlos McEwan 

Insert a custom object from Accounts into Tasks

I am trying to insert a custom object from accounts, (in this case it is our prospects' current suppliers) into tasks.  That way, when our sales people pull up their tasks as they are making calls, they will automatically see who the current supplier is without having to look at the account.  I am new to salesforce but what I have gathered is that I need to create a trigger and use Apex?  Help!
Cloud AtlasCloud Atlas
Are you talking about  custom "fields" or "objects"?? 
because those are two separate animals...

From the description, it looks like you just want one field from Account object to show up under tasks ..
If this is so, can you try creating a custom lookup field under Activities, then a seperate formula field will be able to automatically let you add Supplier Name on Tasks.
Tasks and Events are activity types. 
You will be able to add the custom formula field to the tasks ( and even Evenets layout).
So everytime a task is created, the supplier name from account object will get inserted to the task automatically.

That I think should solve your need.
Carlos McEwanCarlos McEwan
Yes, sorry, I meant a custom field from accounts.  I tried creating a custom lookup from activites, but it seems to only allow a lookup from one object to another object and not a particular custom field like "supplier".  In other words, it wants to give me the account and not just the field.  So I'm not sure if I am even doing the lookup correctly.
Cloud AtlasCloud Atlas
Yes you are doing it right.
Setup the lookup field to the account object first.
Make sure to add it to the Tasks layout.
Once you have the lookup, then you should be able to setup another field using formula for Supplier Name.
This will trigger the formula to bring over "Supplier Name"

The only drawback is that your users will have to lookup the account to which this task is related everytime they create a task.
And I am certain,  there will be a "Related To" field aleready showing this account info.
So on your UI, you will have two fields showing the same value.
But atleast you won't have to code anything.

Hope this helps in some way.
Carlos McEwanCarlos McEwan
Thank you!  I will give this a try.
Best regards