【问题标题】:condition of FetchXml query not taken account of未考虑 FetchXml 查询的条件
【发布时间】:2019-04-13 05:54:43
【问题描述】:

我们目前正在 Dynamics 365 门户上安装博客。 想要修改帖子的布局,我们根据这个结构重新创建了一个模板:https://community.adxstudio.com/products/adxstudio-portals/documentation/configuration-guide/liquid-templates/objects/blogs/

因为 adx “post” 对象不包含标签,所以我们必须使用 fetchxml 查询来获取它们。

问题是查询检索所有标签: 只有 Général 标签应该只显示在第一个帖子上。

完整代码:

{% assign blog = blogs['Actualités et annonces'] %}
{% assign posts = blog.posts %}
<div class="col-md-8">
    <div class="content-panel panel panel-default">
        <div class="panel-heading">
            {% assign sitemarker = sitemarkers["Blog Home"] %}
            {% assign snippet = snippets["Home Blog Activity Heading"] %}
            <a class="pull-right" href="{{sitemarker.url}}"> All Blogs </a>
            <h4>
                <a class="feed-icon fa fa-rss-square" href="{{ blogs.feedpath }}">
                    {{ snippet.adx_value }}
                </a><div class="grid-container">
                    {% for post in posts.all %}
                    <div class="grid-item">
                        <a class="image-header" href="{{ post.url }}">
                            {% if post.new_category %}
                            {% assign category = entities.new_vignette[post.new_category.id] %}
                            {% assign imgpath = category.new_path %}
                            {% elsif post.new_vignette %}
                            {% assign imgpath = post.new_vignette %}
                            {% else %}
                            {% assign imgpath = "../pocfabien/avarap-entete" %}
                            {% endif %}
                            <img class="img-responsive img-post" src="{{imgpath}}">
                        </a>
                        <div class="content-header">
                            <h4 class="list-group-item-heading">
                                <a href="{{ post.url }}">{{ post.title }}</a>
                            </h4>
                            <br />
                            <abbr>{{ post.publish_date }}</abbr>
                        </div>
                        <div class="content-preview">
                            {{post.adx_summary}}
                        </div>
                        <div>
                            {% fetchxml tags %}
                            <fetch>
                                <entity name="adx_tag">
                                    <attribute name="adx_name" />
                                    <attribute name="adx_tagid" />
                                    <link-entity name="adx_blogpost_tag" from="adx_tagid" to="adx_tagid" intersect="true">
                                        <filter>
                                            <condition attribute="adx_blogpostid" operator="eq" value="{{ post.adx_blogpostid }}" />
                                        </filter>
                                    </link-entity>
                                </entity>
                            </fetch>
                            {% endfetchxml %}
                            {% for tag in tags.results.entities %}
                                {{ tag.adx_name }}
                                {% unless forloop.last %} | {% endunless %}
                            {% endfor %}
                        </div>
                        <img class="plusign" src="plusign.png">
                    </div>
                    {% endfor %}
                </div>
            </h4>
        </div>
    </div>
</div>

PS : 如果您有解决方案来检索 n:n 关系实体而无需 fetchXml 查询,我会全力以赴。

【问题讨论】:

  • 你解决了这个问题吗?

标签: dynamics-crm crm dynamics-crm-online dotliquid adxstudio-portals


【解决方案1】:

我认为您的 FetchXML 不正确。如果您使用 Advanced Find 创建 FetchXML,它非常简单。这是一个帐户引导示例,请注意多对多相交表中的附加链接实体。

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
  <entity name="account">
    <attribute name="name" />
    <link-entity name="accountleads" from="leadid" to="accountid" visible="false" intersect="true">
      <link-entity name="lead" from="leadid" to="accountid" alias="ac">
        <filter type="and">
          <condition attribute="leadid" operator="eq" uiname="Test Lead" uitype="lead" value="{FC271420-B2BB-4A87-B852-1DF7CF4B4F3E}" />
        </filter>
      </link-entity>
    </link-entity>
  </entity>
</fetch>

【讨论】:

    【解决方案2】:

    我认为 XML 已关闭,请尝试在高级搜索中创建所需的过滤器并下载 FetchXML

    希望对你有帮助

    M.Acosta.D

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-09-07
      • 1970-01-01
      • 2013-05-19
      • 2019-08-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多