SBX - Search With Button

SBX - Forum Post Title

Use a variable inside LIQUID D365 entity tag

Microsoft Dynamics CRM Forum

Tom Thompson asked a question on 17 Nov 2018 7:32 AM
My Badges

Question Status

Suggested Answer

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

Reply
Suggested Answer

Hi Tom,

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

Reply
Tom Thompson responded on 18 Nov 2018 8:06 AM
My Badges

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 %}
Reply
Ravi Kashyap responded on 13 May 2019 8:22 PM

Hi Tom,

Did you find the fix for this error?

Reply
Suggested Answer

Hi Tom,

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

Reply

SBX - Two Col Forum

SBX - Migrated JS