Skip to main content

customer

in Deployteq Functions
Authors list
Published: Oct 17, 2024|Last updated: Oct 17, 2024

Using the {{customer}} or {{$customer}} function, it's possible to display all customer data for the user in your content. The easiest way to add these fields is in the content editor;

image.png image.png

This generates the following source code:

Note


customer

{{customer field='lastname' default='Achternaam is leeg'}} {{$customer.lastname}}
copy

ArgumentsCopy link to Arguments to clipboard

The following arguments can be used with this function:

Argument

Description

Field

The customer field that needs to be displayed.

Default

A default value that can be specified for the field. This value will be displayed if the field is empty.

Assign

The ability to store the content in a variable.

If the {{$customer}} function is used, the standard system fields can be called directly and no additional arguments are needed. Here is an overview of all available fields:



{{$customer.address}}

{{$customer.address2}}

{{$customer.address3}}

{{$customer.addressnumber}}

{{$customer.addressnumbersuffix}}

{{$customer.alt_address}}

{{$customer.alt_address2}}

{{$customer.alt_address3}}

{{$customer.alt_addressnumber}}

{{$customer.alt_addressnumbersuffix}}

{{$customer.alt_city}}

{{$customer.alt_country}}

{{$customer.alt_emailaddress}}

{{$customer.alt_state}}

{{$customer.alt_zipcode}}

{{$customer.birthday}}

{{$customer.birthplace}}

{{$customer.bouncecount_hard}}

{{$customer.bouncecount_soft}}

{{$customer.city}}

{{$customer.companyname}}

{{$customer.complaintcount}}

{{$customer.contactman}}

{{$customer.country}}

{{$customer.createdat}}

{{$customer.createdby}}

{{$customer.department}}

{{$customer.email_address}}

{{$customer.external_id}}

{{$customer.faxnumber}}

{{$customer.firstname}}

{{$customer.gender}}

{{$customer.homephone}}

{{$customer.id}}

{{$customer.imageurl}}

{{$customer.initials}}

{{$customer.jobtitle}}

{{$customer.lastname}}

{{$customer.maritalstatus}}

{{$customer.middlename}}

{{$customer.mobilephone}}

{{$customer.modifiedat}}

{{$customer.modifiedby}}

{{$customer.optin}}

{{$customer.pobox}}

{{$customer.prefix}}

{{$customer.state}}

{{$customer.smsoptin}}

{{$customer.suffix}}

{{$customer.title}}

{{$customer.track}}

{{$customer.website}}

{{$customer.workextension}}

{{$customer.workmobile}}

{{$customer.workphone}}

{{$customer.zipcode}}

Examples customer example

Name: {{customer|htmlentities field='firstname'}} {{customer|htmlentities field='lastname'}} (Externalid: {{customer|htmlentities field='externalid'}})

An alternative notation: {{$customer.firstname}} {{$customer.lastname}} (Externalid: {{$customer.externalid}})

Output:

Name: Olaf Jansen (Externalid: A98123) An alternative notation: Olaf Jansen (Externalid: A98123)

customer assign

{{customer|htmlentities field='optin' assign='optin'}} {{if $optin eq 'Y'}}You are already subscribed to the newsletter{{else}}You are not yet subscribed to our newsletter{{/if}} (Optin value: {{$optin}})

Output:

You are already subscribed to the newsletter (Optin value: Y) You are not yet subscribed to our newsletter (Optin value: N)

customer translate

{{customer|translate:'Y,You are already subscribed to the newsletter,N,You are not yet subscribed to our newsletter ' field='optin'}}

Output:

You are already subscribed to the newsletter You are not yet subscribed to our newsletter

Datamodel data With {{$customer}}, you also have access to all data model records that are linked to a customer. By using the associated table name, all records of the customer are made available in an object. In the example below, we have a table named MyTable linked to the customers table:

In this example, there are 2 records available for a customer:

customer datamodel

{{$data = $customer.MyTable}} {{$data|print_r}}

Outcome:

Array ( [0] => stdClass Object ( [clang_id] => clang_b [broadcastid] => 6876 [campaignid] => 22 [mailingtype] => newsletter [subject] => Congratulations to the newly graduated! 🎈 [productid] => 58963 [senddate] => 2023-07-11 ) [1] => stdClass Object ( [clang_id] => clang_d [broadcastid] => 7653 [campaignid] => 45 [mailingtype] => service mail [subject] => You've been a customer for a year! [productid] => 31123 [senddate] => 2024-07-11 ) )

With the help of a filter, it is possible to filter the results, and with a foreach, you can loop through all the available data.:

customer datamodel foreach

{{$data = $customer.MyTable|filter:"mailingtype":"service mail"}} {{foreach from=$data item=element}} {{foreach from=$element key=key item=item}} {{$key}}: {{$item}} {{/foreach}} {{/foreach}}

Uitkomst:

clang_id: clang_d broadcastid: 7653 campaignid: 45 mailingtype: service mail subject: You've been a customer for a year! productid: 31123 senddate: 2024-07-11

next pageenvironment
previous pagecancel_mail

Please log in or register to submit a comment.

Page sections