+ Start a Discussion
Karleen MendozaKarleen Mendoza 

Formula field to display value from related custom object record?

I want to display a custom field from a custom object that is related to a Task. Basically, we have a custom object named Policy - I want to pull the Expiration date from the Policy record and put that field's value onto the related Task record. How do I do this? The formula field allows to pull related Opportunity fields, but not custom object fields?
Dev_AryaDev_Arya
Hi Karleen,

Custom task fields can only access the Id (WhatId) of the parent record irrespective its standard or custom object. This limitation is due to the  polymorphism that means a task can be associated to opportunity, account, custom obj, etc. SF is working on how to grab the polymorphic related record values. If you are saying you can access opportunities fields in the related task list, then I am not aware of it and will be really interested in knowing it. May be I missunderstood your use case.  
However there is a way how one could achieve this, creating a process builder, accessing the what id and determining the type.. I can explain in detail if you want.

Hope this helps.

Cheers, Dev
Karleen MendozaKarleen Mendoza
Hi Dev, 
Thanks for the response. I understand the limitation - I am hoping there is a workaround. How would I acheive this using Process builder?
Karleen MendozaKarleen Mendoza
Dev, took a look at the article. This helps, however - the field I want is on the related record. I don't want to update the related record, I want to update a field on the Task record. 

Basically, a task record is related to a Policy record. The policy record has a field called Expiration Date. I want this Expiration Date field on the Task record so our users do not have to flip back and forth to see the Expiration Date. Hope that makes sense.
Dev_AryaDev_Arya
Hi Karleen,
I understood your use case :-). As I mentioned before there is a way to achieve this with some work. So the work around is as follows: 
1. create a process builder that checkst the what id of the task.
2. Every sObject Id has a specific start  number, for ex:  If it starts with '001'its an account or if '006 then its an Opportunity and so on. This link has more information https://help.salesforce.com/articleView?id=000005995&type=1 . You can get the one for your custom object policy by looking at any record.
3. lets say it start withs 'a00'. From the process builder, invoke an apex method and in that method have a check condition based on the start number and have look up to the record (policy in ur case) and updated the expiration field on your task record.

As I said, it involves som work but this works.

Hope this helps. if yes, please mark the solution green, :-)

Cheers,Dev
Karleen MendozaKarleen Mendoza
Thanks Dev. I'm sorry, I'm not to keen on Apex method. I wouldn't even know where to begin using Apex method. Is there a way to do this without using Apex?
Dev_AryaDev_Arya
the apex part can also be achieved using a headless flow.