Dynamics Portals: Liquid Reference (the missing Appendix A)

By | August 30, 2018

 

If you are starting to work with Liquid, Microsoft has a rather detailed documentation here:

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/portals/custom-templates-dynamic-content

But, after a few days of having to scan through that documentation, I’ve started to realize that it would be great to also have a reference page that would list all Liquid keywords and cross-reference them with the corresponding documentation pages. The purpose of such page would be to show me, quickly, what’s available. In one place. So that I would not have to scan through the documentation just to figure out if there is something I could use.

If it were a technical book, this kind of reference would probably go to the Appendix A, and, hence, that’s what is is.. the missing Appendix A (and you know what? I did not realize this thing is going to be that long, yet there is a part about liquid objects that’s still not finished):

LIQUID OPERATORS (Click here for the details)

==      Equals

!=
       Does not equal

>
        Greater than

<
         Less than

>=
      Greater than or equal to

<=
      Less than or equal to

Or
      Condition A or condition B

And
    Condition A and condition B

startswith  tests whether a string starts with a given substring.

endswith    tests whether a string ends with a given substring

contains      tests for the presence of a substring within a string

 

LIQUID TYPES(Click here for the details)

String, Number, Boolean, Array, Dictionary, DateTime, Null

 

LIQUID CONTROL FLOW(Click here for the details)

if,else,elseif,endif; unless,endunless; case,when,endcase

 

LIQUID ITERATION TAGS (Click here for the details)

for/endfor; cycle; tablerow

 

VARIABLE TAGS (Click here for the details)

assign          Creates a new variable

capture       Captures the content within its block and assigns it to a variable

 

TEMPLATE TAGS (Click here for the details)

include                  Includes the contents of one template in another, by name

block/extends   Provides template inheritance

comment             Allows you to leave un-rendered code inside a Liquid template

 

ENTITY TAGS (Click here for the details)

chart                      Adds a Dynamics 365 chart to a web page

editable
                Renders a given Dynamics 365 portals CMS object as editable

entityview
            Loads a given Dynamics 365 view

searchindex
         Performs a query against the portal search index

entityform
           Fully renders a Dynamics 365-configured entity form

 

LIQUID FILTERS (Click here for the details)

batch                        Divides an array into multiple arrays of a given size

concat
                      Concatenates two arrays into a single new array

except
                      Select all the objects in an array where a given attribute does not have a given value

first
                           Returns the first element of an array

group_by
                Group the items in an array by a given attribute

join
                            Joins the elements of an array with the character passed as the parameter

last
                            Returns the last element of an array

order_by
                 Returns the elements of an array ordered by a given attribute of the elements of the array

random
                    Returns a single randomly-selected item from the array

select
                        Selects the value of a given attribute for each item in an array, and returns these values as an array

shuffle
                      Applied to an array, returns a new array with the same items, in randomized order

size
                             Returns the number of items in an array

skip
                             Skips a given number of items in an array, and returns the rest

take
                             Takes a given number of items from the array, returning the taken items

then_by
                     Adds additional subsequent ordering to an array already ordered byorder_by

where
                         Select all the objects in an array where a given attribute has a given value

date
                             Formats a DateTime value using a .NET format string

date_add_days
        Adds the specified number of whole and fractional days to the DateTime value

date_add_hours
      Adds the specified number of whole and fractional hours to the DateTime value

date_add_minutes
Adds the specified number of whole and fractional minutes to the DateTime value

date_add_months
  Adds the specified number of whole months to the DateTime value

date_add_seconds
Adds the specified number of whole and fractional seconds to the DateTime value

date_add_years
       Adds the specified number of whole years to the DateTime value

date_to_iso8601
     Formats a DateTime value according to the ISO 8601 standard

date_to_rfc822
        Formats a DateTime value according to the RFC 822 standard

current_sort
             Given a sort expression, returns the current sort direction for a given attribute

metafilters
                Parses an entitylist filter_definition JSON value into filter option group objects

reverse_sort
             Given a sort direction, returns the opposite sort direction

ceil
                                Rounds a value up to the nearest integer

divided_by
                 Divides a number by another number

floor
                             Rounds a value down to the nearest integer

minus
                           Subtracts a number from another number

modulo
                       Divides a number by another number and returns the remainder

plus
                              Adds a number to another number

round
                          Rounds a value to the nearest integer or specified number of decimals

times
                           Multiplies a number by another number

append
                       Appends a string to the end of another string

capitalize
                   Capitalizes the first word in a string

downcase
                  Converts a string into lowercase

escape
                        HTML-escapes a string

newline_to_br
         Inserts a <br /> line break HTML tag at each line break in a string

prepend
                     Prepends a string to the beginning of another string

remove
                       Remove all occurrences of a substring from a string

remove_first
            Removes the first occurrence of a substring from a string

replace
                       Replaces all occurrences of a string with a substring

replace_first
            Replaces the first occurrence of a string with a substring

split
                             The split filter takes on a substring as a parameter

strip_html
                 Strips all HTML tags from a string

strip_newlines
        Strips any line breaks from a string

text_to_html
           Formats a plain text string as simple HTML

truncate
                    Truncates a string down to a given number of characters

truncate_words
     Truncates a string down to a given number of words

upcase
                       Converts a string into uppercase

url_escape
               URI-escape a string, for inclusion in a URL

xml_escape
             XML-escape a string, for inclusion in XML output

boolean
                    Attempts to convert a string value into a Boolean

decimal
                     Attempts to convert a string value into a decimal number

integer
                      Attempts to convert a string value into an integer

string
                         Attempts to convert a value into its string representation

add_query
               Appends a query string parameter to a URL

base
                           Gets the base URL of a given URL

host
                            Gets the host part of a URL

path
                           Gets the path part of a URL

path_and_query
   Gets the path and query part of a URL

port
                           Gets the port number of a URL

remove_query
       Removes a query string parameter from a URL

scheme
                     Gets the scheme part of a URL

default
                      Returns a default value for any variable with no assigned value (i.e. null)

file_size
                    Applied to a number value representing a number of bytes, returns a formatted file size with a unit of appropriate scale

has_role
                   Applied to a user, returns true if the user belongs to the given role. Returns false if not

 

LIQUID OBJECTS (Click here for the details)

THAT’s a long list here.. coming soon

 

LIQUID.. UNDOCUMENTED (Except by Colin Vermander. Click here for the details)

fetchxml                 Query data from Dynamics using fetch xml

One thought on “Dynamics Portals: Liquid Reference (the missing Appendix A)

Leave a Reply

Your email address will not be published. Required fields are marked *