• Resolved josephmarkovich

    (@josephmarkovich)


    I’ve been using the Dynamics 365 plugin for a long time and am now starting to use the Dataverse plugin.

    Have installed it to my site and activated it. This is my code on the page:

    {% fetchxml collection=”exhibits” cache=”PT30M” %}
    <fetch mapping=”logical” output-format=”xml-platform” mapping=”logical” distinct=”true”>
    <entity name=”bsdepot_exhibit”>
    <attribute name=”bsdepot_exhibitid”/>
    <attribute name=”bsdepot_exhibitname”/>
    <attribute name=”bsdepot_exhibittext”/>
    <order descending=”false” attribute=”bsdepot_exhibitname”/>
    <filter type=”and”>
    <condition attribute=”statecode” value=”0″ operator=”eq”/>
    </filter>
    </entity>
    </fetch>
    {% endfetchxml %}

    {% if exhibits.results.entities|length > 0 %}

      {% for exhibit in exhibits.results.entities %}

    • {{exhibit[“bsdepot_exhibitname”]}} — {{exhibit[“bsdepot_exhibittext”]}}
    • {% endfor %}

    {% else %}
    <p>No exhibits found.</p>
    {% endif %}`

    It doesn’t load anything from Dataverse, just shows the Twig scripting when viewing the page.

    Am I missing something in my Twig syntax or something with the plugin? I also noticed there is no entity binding drop-down in the WordPress admin creating a page.

    Thank you.
    Joe

    The page I need help with: [log in to see the link]

Viewing 4 replies - 16 through 19 (of 19 total)
  • Plugin Author alexacrm

    (@alexacrm)

    @josephmarkovich really need debug traces…

    humour me, try this in a browser
    https://yourinstance.crm.dynamics.com/api/data/v9.2/accounts?fetchXml=%3Cfetch%20top%3D%222%22%3E%3Centity%20name%3D%22account%22%3E%3Call-attributes%2F%3E%3C%2Fentity%3E%3C%2Ffetch%3E

    that should return 2 accounts from your org

    If that works try this as fetchxml in the code

    <fetch top="2"><entity name="accounts"><all-attributes/></entity></fetch>

    That should give you the same results.

    Now, one thing that is odd is that you keep pasting xml with fancy quotes. Something is changing straight quotes " to fancy . If that happens, your xml is in fact invalid

    Thread Starter josephmarkovich

    (@josephmarkovich)

    Progress!

    So, the Power App I am developing doesn’t using the Account table, but it uses the Contact table, so I changed your URL above to contacts instead. It returns the top 2.

    In WordPress, it doesn’t return anything, but I made this change to the twig:

    It was this:
    {% fetchxml collection=”exhibits” cache=”PT30M” %}
    <fetch top=”2″><entity name=”contact”><all-attributes/></entity></fetch>
    {% endfetchxml %}

    Now it is this (all on one line):

    {% fetchxml collection=”exhibits” cache=”PT30M” %}<fetch top=”2″><entity name=”contact”><all-attributes/></entity></fetch>{% endfetchxml %}

    No more FetchXML errors! But it still doesn’t return any data.

    Will the debug logs uncover anything else? I have downloaded them from the server.

    Joe

    Plugin Author alexacrm

    (@alexacrm)

    Logs with debug flag set will give more insights into what being sent/received.
    You keep mixing the quotes
    <fetch top=”2″>
    Do you see the difference?
    I really don’t think it’s a problem with the plugin but rather with your environment. The fact that you removed line break and something changed is an indicator of that. If you’re using our Twig block (are you?) then it’s a clear indication that you have something that interferes with the plugin saving the data (replacing line breaks with <br>, for example).
    I don’t see how I can help any further here. If you are interested in us digging further from our side, please contact us on [email protected]

    Thread Starter josephmarkovich

    (@josephmarkovich)

    Somehow, I managed to get everything working and besides the line break thing, I removed all of the security to the application user in Power Apps and then put it all back. It’s reading the data now.

    Thank you for all the help George.

    Joe

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Showing Twig syntax instead of data from Dataverse’ is closed to new replies.