web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Use a variable inside LIQUID D365 entity tag

(0) ShareShare
ReportReport
Posted on by

Hello All

Is it possible to use a variable inside a Dynamics 365 liquid tag?  For example, I would like to set the entity form name using the following tag

{% entityform name: 'My Entity Form' %}

But for 'My Entity Form' I would like to use a variable.  My code is as follows:

    {% assign eForm =  page.adx_entityform.name %}
    {% assign mBudgetID = request.params['id'] %}
	  {% assign mBudget = entities.new_budget[mBudgetID] %}
      {% if mBudget %}
        {% assign mbState = mBudget.statuscode.label %}
        {% if mbState == 'Submitted' %}
              {% entityform name:'My Entity Form' %}
        {% else %}
              {% entityform name:{{ eForm }} %}
        {% endif %}
      {% endif %}


The resulting page displays the following error:  Liquid error: Value cannot be null. Parameter name: input

Any assistance is greatly appreciated

Tom

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    Hi Tom,

    You can declare variabole using assign , and get tge variable using capture .Please have a look below reference.

    [View:https://community.adxstudio.com/products/adxstudio-portals/documentation/configuration-guide/liquid-templates/basics/types/]

    [View:https://m.youtube.com/watch?v=VAdQpiHhR7o]

  • Tom Thompson Profile Picture
    on at

    Thank you Goutam.  I had previously tried to build the output using the capture tags, but was unsuccessful.

    Below is an example of the code

        {% assign eForm =  page.adx_entityform.name %}
        {% assign mBudgetID = request.params['id'] %}
    	  {% assign mBudget = entities.new_budget[mBudgetID] %}
          {% if mBudget %}
            {% assign mbState = mBudget.statuscode.label %}
            {% if mbState == 'Submitted' %}
                  {% entityform name:'My Entity Form' %}
            {% else %}
                    {% capture rForm %} {% entityform name:'{{ eForm }}' %}{% endcapture %} 
                    {{ rForm }}               
                    {% entityform name:{{ rForm }} %}
            {% endif %}
          {% endif %


    I had also tried a variation of this, as in the example below

        {% assign eForm =  page.adx_entityform.name %}
        {% assign mBudgetID = request.params['id'] %}
    	  {% assign mBudget = entities.new_budget[mBudgetID] %}
          {% if mBudget %}
            {% assign mbState = mBudget.statuscode.label %}
            {% if mbState == 'Submitted' %}
                  {% entityform name:'My Entity Form' %}
            {% else %}
                    {% capture rForm %} '{{ eForm }}'{% endcapture %}
                    {{ rForm }}               
                    {% entityform name:{{rForm}} %}
            {% endif %}
  • RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi Tom,

    Did you find the fix for this error?

  • Suggested answer
    Nicholas Hayduk Profile Picture
    2,863 on at

    You don't need the {{ inside the {% tag.  So instead of:

    {% entityform name:{{rForm}} %}

    Just do:

    {% entityform name: rForm %}

    Nick

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans