• Resolved kimineko

    (@kimineko)


    Hey there,

    I am testing your plugin as we are considering to use it for outputting our CRM-Data to our Website.

    So far everything works, but trying to display links which are saved as text fields in D365. It seems that if we put Twig’s Curly Brackets as the href, the plugin returns the following error: Unexpected error: Unexpected character “&” in “template_10243…”

    Here’s an example that works, as long as there is only plain text / a regular link in the href (<td>{{ record[“ud_name”].value}}</td>):

    [msdyncrm_twig]
    {% view entity="ud_tutorial" name="Website | CA-Kurse (kommende)" count="10" cache="PT60M" %}
    <table class="crm-table-wrapper striped" style="border:none">
    <thead class="">
    <tr class="crm-table-th">
    <th style="width:5%"></th>
    <th style="width:15%">Kurs</th>
    <th style="width:15%">Durchführung</th>
    <th style="width:12%;">Beginn</th>
    <th></th>
    <th style="width:50%">Ende</th>
    </tr>
    </thead>
    <tbody>
    {% for recordId, record in entityview.rows %}
    <tr>
    <td>{{ record["ineko_booking_status"].value}}</a></td>
    <strong><td><a href="test">{{ record["ud_name"].value}}</a></td></strong>
    <td>{{ record["udc_executionmode"].value}}</td>
    <td>{{ record["ud_startdatetime"].value | date('d.m.Y') }}</td>
    <td> – </td>
    <td>{{ record["ud_enddatetime"].value | date('d.m.Y') }}</td>
    </tr>
    {% endfor %}
    </tbody>
    </table>
    {% endview %}
    [/msdyncrm_twig]

    This on the other hand does not work:

    [msdyncrm_twig]
    {% view entity="ud_tutorial" name="Website | CA-Kurse (kommende)" count="10" cache="PT60M" %}
    <table class="crm-table-wrapper striped" style="border:none">
    <thead class="">
    <tr class="crm-table-th">
    <th style="width:5%"></th>
    <th style="width:15%">Kurs</th>
    <th style="width:15%">Durchführung</th>
    <th style="width:12%;">Beginn</th>
    <th></th>
    <th style="width:50%">Ende</th>
    </tr>
    </thead>
    <tbody>
    {% for recordId, record in entityview.rows %}
    <tr>
    <td>{{ record["ineko_booking_status"].value}}</a></td>
    <td><a href="{{record["ud_name_url"].value}}">{{ record["ud_name"].value}}</a></td>
    <td>{{ record["udc_executionmode"].value}}</td>
    <td>{{ record["ud_startdatetime"].value | date('d.m.Y') }}</td>
    <td> – </td>
    <td>{{ record["ud_enddatetime"].value | date('d.m.Y') }}</td>
    </tr>
    {% endfor %}
    </tbody>
    </table>
    {% endview %}
    [/msdyncrm_twig]

    The String that we are trying to put as the href does not contain an ampersand, as mentioned in the error message. Am I missing something or maybe just using the wrong syntax?

    Looking forward to your replies.

    Best
    Kim

    • This topic was modified 3 years, 4 months ago by kimineko.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author alexacrm

    (@alexacrm)

    Hi Kim,

    WordPress encodes the attribute value hence the “corrupted” URL. Try this:

    {% set url = record["ud_name_url"].value %}
    <td><a href="{{ url }}">{{ record["ud_name"].value}}</a></td>
    

    Also, I don’t believe you have to use record["ud_name_url"].value syntax and can use just record.ud_name_url in which case you can try simply:

    <td><a href="{{ record.ud_name_url }}">{{ record.ud_name }}</a></td>

    Thread Starter kimineko

    (@kimineko)

    Hey,

    thank you very much for the quick and helpful reply! Both ways that you laid out work.

    The first one as it is, for the second one to work – in our case – we needed to append .value as it would otherwise display “Array”. So for anyone who stumbles upon this question in the future:

    <td><a href="{{ record.ineko_participant_link_sp.value }}">{{ record.ud_name.value }}</a></td>

    Best regards
    Kim

    • This reply was modified 3 years, 4 months ago by kimineko.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘href not rendering correctly’ is closed to new replies.