2

Is there a limitation merging dependent picklist values into a VF email template? I have a picklist (Case.Denial_Reason__c) that is controlled by Case.Status.

I can merge values such as status or text fields from Case just fine:

{!relatedTo.Case__r.Status} 

{!relatedTo.Case__r.Customer_First_Name__c}

^ these both are merged and displayed ^


However, if I include:

{!relatedTo.Case__r.Denial_Reason__c}

It's not merged/displayed. I've triple checked FLS is correct for this field. I also included the controlling field with the dependent field, still nothing.

My next thought was to create a text formula field that simply channels the value from Denial_Reason__c, i.e. TEXT(Denial_Reason__c):

{!relatedTo.Case__r.Temp_Formula_Denial_Reason__c}

but it's not merged. However, as soon as I change the formula field's value to be a static string such as "HELLO", the formula field is merged/displayed.

It seems as though anything that uses Case.Denial_Reason__c as its true "source" can't be directly merged. I think I'll have to write the value in the relatedTo object's trigger handler, unless I'm overlooking something here?

2

Absolutely baffled as to why this fixed the issue, but here's an explanation for anyone that encounters this post:

The transaction to produce the email from this template looked like this:

  1. Update case to meet certain criteria (i.e. Status == _______ )
  2. This update caused service-layer Apex for Case before update logic to fire, creating a Communication_Job__c record (this is the type the template is relatedTo
  3. The creation of this Communication_Job__c record fired a workflow, which sent an email alert using the template in the original post. The Case fields were merged in through the Lookup from Communication_Job__c to Case.

Moving the service-layer Apex logic in #2 to after update in our handler solved this issue - the dependent picklist in question now appears as expected in the template. This will forever haunt me....

  • Missed a closing paren on item 2. Interesting problem. – Adrian Larson Aug 16 '16 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.