How to format a lookup field from within a template

edited April 11, 2017 in Questions
I am a fan of using both the Field Renderer and Display Template to give context.
<field id="Business_State__c" type="REFPICK" displaytemplate="{{Name}}  {{State_Code_c__c}}">
<filters/>
</field>
This gives me a great picklist that shows the state code and also the full state name.

This field features in a template:
<field type="COMBO" allowhtml="false">
<label>{{$Label.Business_Address}}</label> <template>{{Business_Address_1__c}} {{Business_Address_2__c}} {{Business_Address_3__c}} {{Business_City__c}} {{Business_State__c}} {{Business_Zip_Postal_Code__c}} {{Business_Country2__c}} </template> </field>
Which looks like this:
  1. Can I include the picklist formatting from the first example in the template?
  2. If so, can the picklist (with the 2 field Display Template) only appear on the popup, and not on the read layout?
  3. Can the lines that are missing in the above example not show on the read layout?

Comments

  • edited April 11, 2017
    Well hello there Ross ...

    On your point 3. We do something similar by using a bit more Mustache syntax like this:
    {{#Business_Address_2__c}}{{Business_Address_2__c}}{{/Business_Address_2__c}}
    which basically says "if Business_Address_2__c exists, then render it". 

    To get all the line breaks and spaces just right, we have HTML and Mustache in our address template like this:
    {{#ShippingCity}}
        <div>Location Address</div>
        <div>{{#ShippingStreet}}{{ShippingStreet}}{{/ShippingStreet}}</div>
        <div>{{ShippingCity}} {{#ShippingState}}{{ShippingState}} {{/ShippingState}}{{ShippingPostalCode}}</div>
        {{#ShippingCountry}}<div>{{ShippingCountry}}</div>{{/ShippingCountry}}
    {{/ShippingCity}}
  • Emily DavisEmily Davis ✭✭✭✭
    edited March 2, 2017
    Hey, Ross,
    Glenn's advice is good for conditionally displaying certain fields. Unfortunately, there is no way to control how fields render in the template popup currently. I think it would be a great idea, though (and I think other customers would agree)! You should suggest it in our community.
    Emily
  • Emily DavisEmily Davis ✭✭✭✭
    edited March 2, 2017
    Good news! I just found out that Skuid's Summer 14 release will allow you to customize the edit popup on template fields! Yay!
  • edited September 1, 2014
    Hello Glenn!

    Thanks for this. With the news from Emily on soon being able to edit the popup, this may just be the ticket!
  • edited September 1, 2014
    Hi Emily

    This is very good news indeed. Can't wait!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!