• 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 15 replies - 1 through 15 (of 19 total)
  • Plugin Author alexacrm

    (@alexacrm)

    Hi Joe,

    if just twig is displayed, keep in mind that we use different shortcode in this version, it’s [icds_twig] instead of [msdyncrm_twig]. Actually, in V2 we recommend using special twig block that includes syntax highlighting, intellisense, and other goodness.

    Bindings, as implemented in V1 is not a big deal to replicate in twig using params collection, e.g.

    
    {% set currentrecord = entities.account[params.id] %}
    <h2>{{ currentrecord.name }}</h2>
    

    V2 takes a different approach, with support for multiple bindings, alternate keys, explicit user binding, etc and is part of the premium (that is currently in beta testing). See https://docs.alexacrm.com/integration-cds/entity-binding/

    Thanks
    George

    • This reply was modified 3 years, 7 months ago by alexacrm.
    • This reply was modified 3 years, 7 months ago by alexacrm.
    Thread Starter josephmarkovich

    (@josephmarkovich)

    Hi George-

    Thanks much for the shortcode help!

    Last question about this — is there anything wrong in my code above where it won’t show any results. I have data in the bsdepot_exhibits table, but it just keeps showing “No exhibits to display” on the page instead.

    I’ve used the D365 plugin for a long time now and I feel like I relearning this all over again with the Dataverse plugin.

    Thank you.
    Joe

    Plugin Author alexacrm

    (@alexacrm)

    @josephmarkovich

    Twig looks fine. I suggest checking the role of the app user you created for plugin to connect.

    HTH
    George

    Thread Starter josephmarkovich

    (@josephmarkovich)

    Hi George-

    This is very strange to me and I wonder if I have some kind of configuration set up incorrectly with the application user?

    I followed the instructions exactly to create the app user and even gave it the System Administrator role and still showing no results on the WordPress page.

    Is there something else I can check? Should I remove the application user and set it up again?

    Joe

    Plugin Author alexacrm

    (@alexacrm)

    @josephmarkovich we have very extensive diagnostic logging in the Dataverse plugin. Enable debug mode then run your twig again and check the logs to see if there is anything that catches your eye.

    Thread Starter josephmarkovich

    (@josephmarkovich)

    Here are the errors I am receiving:

    webapi-toolkit Not Found POST https://beverlyshoresdepot.crm.dynamics.com/api/data/v9.1/alexacrm_WordPressRequest

    integration-cds ICDS_AUTH_KEY is not defined or not valid, using AUTH_KEY instead

    When the load the page on the website, I am receiving this too occasionally:

    Warning: DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 2 in /home/customer/www/bsdepot.org/public_html/wp-content/plugins/integration-cds/vendor/alexacrm/dynamics-webapi-toolkit/src/WebAPI/Client.php on line 292

    As always, thank you.
    Joe

    Plugin Author alexacrm

    (@alexacrm)

    @josephmarkovich can you do the following:

    1. Add {{exhibits.xml}} after the fetch to output
    2. Flush the plugin cache
    3. If you are still not getting the records after refresh then take the XML that is produced, connect to the instance using app user credentials in XrmToolBox, and run the XML in FetchXmlBuilder
    Thread Starter josephmarkovich

    (@josephmarkovich)

    Here is the xml returned:

    <br /> <fetch mapping=”logical”><br /> <entity name=”bsdepot_exhibit”><br /> <attribute name=”bsdepot_exhibitid”/><br /> <attribute name=”bsdepot_exhibitname”/><br /> <attribute name=”bsdepot_exhibittext”/><br /> <order descending=”false” attribute=”bsdepot_exhibitname”/><br /> </entity><br /> </fetch><br />

    When I put it into FetchXMLBuilder I get results back after I take out all the <br/> tags.

    Joe

    Plugin Author alexacrm

    (@alexacrm)

    @josephmarkovich there is some discrepancy between your output and xml in the output
    1. there are no attributes in the fetch
    2. <br /> definitely shouldn’t be there – did you copy pasted from some editor?

    But your original fetch <fetch mapping=”logical” output-format=”xml-platform” mapping=”logical” distinct=”true”> contains mapping attribute twice. Remove one of them, I suspect it could be a bug in the XML parser that we use.

    Plugin Author alexacrm

    (@alexacrm)

    @josephmarkovich

    confirmed, web api does not like duplicate attributes. You can use exhibits.error to check if there was any error executing fetch, as documented.

    Thread Starter josephmarkovich

    (@josephmarkovich)

    Here is what it returns:

    Malformed FetchXML query: could not locate the <entity/> element or entity name not specified

    Joe

    Plugin Author alexacrm

    (@alexacrm)

    @josephmarkovich that is correct. Your fetchxml contains mapping=”logical” twice. Remove one of those and you’ll be fine.

    Thread Starter josephmarkovich

    (@josephmarkovich)

    I am really sorry to be a huge pain here…so my fetch looks like this:

    <fetch distinct=”false” mapping=”logical” output-format=”xml-platform” version=”1.0″>
    <entity name=”bsdepot_exhibit”>
    <attribute name=”bsdepot_exhibitid”/>
    <attribute name=”bsdepot_exhibitname”/>
    <attribute name=”bsdepot_exhibittext”/>
    <order descending=”false” attribute=”bsdepot_exhibitname”/>
    </entity>
    </fetch>

    Copy/pasted this from exporting the XML in Advanced Find and I still receive that error in the thread above.

    Joe

    Plugin Author alexacrm

    (@alexacrm)

    @josephmarkovich I suspect your theme editor inserts unnecessary breaks. Can you paste the fetch into a text editor, remove all the line breaks then put it back? Something like this:
    <fetch><entity name="bsdepot_exhibit"><all-attributes/></entity></fetch>

    Make sure to use straight quotes, looks like your fetch has couple “fancy” ones.

    Thread Starter josephmarkovich

    (@josephmarkovich)

    I copy/pasted it to Notepad, took out all of the lines and put it all on one line.

    <fetch><entity name=”bsdepot_exhibit”><all-attributes/></entity></fetch>

    Even though it is showing the fancy quotes above, they are plain text quotes in WordPress.

    Still get the error.

    Is there possibly something wrong with my Power App?

    Joe

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