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
Richie DRichie D 

$RecordType.Name formula field referenced in another formula field on a different object

Hi,

 

I have a formula which does a case on the $recordType.Name on a parent object. I have another formula field that references this field on a child object. so far so good...

 

I now see that the value on the child is not the same as the parent (which is wrong).  Example below:-

 

Parent__c
field_parent__c = Case($RecordType.Name, 'abc', 1, 'def', 2, 0)

Child__c
field_child__c = parent__r.field_parent__c;

 If parent__c.Recordtype.Name = abc, field_parent__c=1 BUT field_child__c = 0;

 If parent__c.Recordtype.Name = def, field_parent__c=2 BUT field_child__c = 0;

 

Am I right in thinking that the $RecordType.Name field is run against the child record when calculating field_child__c and not just 'grabbing the value from field_parent__c'?

 

Is there a work around?

 

Thanks for any guidance/assistance.

 

Cheers,

Rich.

Starz26Starz26

IIRC I ran into this issue a while back and yes the $RecordType.Name return the recordtype of the CURRENT object not the object that the formula field represents. Since the formula fields are calculated when they are viewed the merge field see the current record......

 

On child object we had to code the ID's of the parent recordtypeID into the child object formula field. (When I say child, It does not have to mean a related object....in our case the object was not related but same results.)

 

We confirmed this with salesforce premier support and there was not work around other than what we did.