La fonction de suggestion automatique permet d'affiner rapidement votre recherche en suggérant des correspondances possibles au fur et à mesure de la frappe.
Removing apostrophe from contact owners name when being pulled into a HubL variable.
Résolue
Hello,
We are using HubL to change the contact info displayed on our site in two ways.
• First, if the visitor has a HubSpot owner, we display the owners phone number.
• Second, if the HubSpot owner (rep) shared a link and includes a URL parameter of ?rep_first=jon&rep_last=smith, it displays Jon Smith’s information.
This is a simplified version of the code:
{% set rep_phone_jon_smith = “516-555-1111" %} {% set rep_phone_shane_oneil = “516-555-2222" %}
{% if owner %}
{% set rep_phone = "{{ rep_phone_"~owner.firstname~"_"~owner.lastname~"|default(‘888-555-1374') }}" %}
<span>{{rep_phone}}</span>
{% else %}
{% set rep_phone = "{{ rep_phone_"~request.query_dict.rep_first~"_"~request.query_dict.rep_last~"|default(‘888-555-1374') }}" %}
<span>{{rep_phone}}</span>
{% endif %}
—
The first problem is this: Shane O’Neil has an apostrophe in his name, which throws off what is displayed when owner.lastname is pulled in.
Is there a way to remove an apostrophe from his name using code?
Using owner.lastname|cut(‘%27') does not seem to work.
Second small issue: the URL parameter reps are sharing are all lowercase, which I assume it should be and this works fine. The contact owner value, however, comes through Title Case, which makes the code not work. How can I force the contact owner value to be lowercase?