Showing results for 
Search instead for 
Did you mean: 

Liquid functions desperately needed

Author Name: Rex Wessels

The following liquid filters and functions will make customizing portals so much more powerful and easy:

  • {{ variable | json }} - The ability to jsonify a variable. This allows to access attributes that are not documented on complex types like lookups and optionset fields
  • Type filters e.g. {% if variable | typeof == "Adxstudio.Xrm.Web.Mvc.Liquid.EntityReferenceDrop" %} - to allow better management of fields and objects returned from Liquid, especially for dates. The only way I could see to determine if a field is a date type is to do: {% capture d1 %}{{ someEntity[fldname] | date_add_days: 0 | date_to_iso8601 }}{% endcapture %}{% assign d2 = d1 | truncate_words: 2%}
    {% if d2 == "Liquid error:..." %}not a date{% else %}It is a date!{% endif %}
  • Improve liquid documentation to include details for objects like EntityReferenceDrop and OptionSetValueDrop and the awesome fetchxml snippet
  • It would be really great to be able to declare small functions in liquid that could be called multiple times, e.g. the code snippet above to determine if a field is a date. This sort of exists by including snippets and passing variables, but could still be considered.
  • Ability to update CRM records from within liquid. e.g. a setting on the user profile {% update user.new_lastpagevisited = page.url %} or any other entity (with correct entity permissions)
  • Ability to execute a custom action from within liquid and get the returned value, e.g. {% assign actionresult = executeAction["new_actionName"] inputvariable1:10, inputvariable2:user.fullname %}
  • Better DateTime control (including daylight savings), and filters for user timezones e.g. {{ entities["someEntity"].createdon | ToUserTimezone }}

It would be really great if you could consider at least some of these functions.

Status: New
Regular Visitor
Status changed to: New
New Member

+1 for adding a json filter. Shopify's liquid implementation already has one.


Without this, creating web templates that return JSON, as many people already do, is error prone due to errant characters that when not encoded break the JSON data format.