最近 X 个月在 CRM 2011 中无法正常运行
我正在创建一个视图并尝试创建正确的搜索,但结果出乎意料。基本上我需要找到过去 x 个月内创建的所有记录。我创建了查询:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="new_object">
<attribute name="new_name" />
<attribute name="new_dateactivated" />
<attribute name="new_currentstatus" />
<attribute name="new_contactid" />
<attribute name="new_accountid" />
<attribute name="new_referralsource" />
<order attribute="new_dateactivated" descending="true" />
<filter type="and">
<filter type="or">
<condition attribute="new_dateenrolled" operator="this-month" />
<condition attribute="new_dateenrolled" operator="last-x-months" value="2" />
</filter>
<condition attribute="ownerid" operator="eq" uiname="---" uitype="systemuser" value="---" />
</filter>
</entity>
</fetch>
但是当我在图表/高级中看到结果时,发现它只显示过去 60 天的结果。例如,如果我在 12 月 23 日立即运行搜索,它将显示从 10 月 23 日到今天的所有结果。我不想这样,我想看到从10月1日到今天的所有结果。看起来好像它正在按滑动比例运行或使用非常简单的函数“过去 X 个月 = X * 30”
我可以创建自定义搜索条件或更改 Dynamics 运行此“过去 X 个月”搜索的方式吗?
I am creating a view and have tried to get the correct search created, but the results are unexpected. Basically I need to find all records that have been created in the last x months. I created my query:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="new_object">
<attribute name="new_name" />
<attribute name="new_dateactivated" />
<attribute name="new_currentstatus" />
<attribute name="new_contactid" />
<attribute name="new_accountid" />
<attribute name="new_referralsource" />
<order attribute="new_dateactivated" descending="true" />
<filter type="and">
<filter type="or">
<condition attribute="new_dateenrolled" operator="this-month" />
<condition attribute="new_dateenrolled" operator="last-x-months" value="2" />
</filter>
<condition attribute="ownerid" operator="eq" uiname="---" uitype="systemuser" value="---" />
</filter>
</entity>
</fetch>
But when I see the results in a chart/advanced find it only shows the results from the previous 60 days. For example if I run the search right now on Dec 23, it will show all the results from Oct 23 to today. I don't want that, I want to see all the results from Oct 1 to today. It seems as if it is running on a sliding scale or using a really simple function "Last X Months = X * 30"
Can I create a custom search criteria or change the way Dynamics runs this "Last X Months" search?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为它需要 X 个月前今天的所有记录(今天,X 个月前的 24 日)。但无论如何,我认为微软必须添加 FetchXml schema 包含 X 个月前的第一天,因为它现在不存在。 (顺便说一句,“上个月”条件实现了您正在寻找的内容,但它只在最后一个月实现,而不是在任何 X 个月前实现。)
所以我认为不可能拦截“最近 X 个月”的情况,因为我打赌它被包裹在某个核心组件中。但是,您可以拦截 FetchXml 通过 jscript 传递到子网格 或通过报表生成器中的 VB 传递到报表。 (图表也可能如此,但这对我来说是未知的领域。)
I think it takes all the records from today's day X months ago (for today, the 24th of X months ago). But anyway, I think MS would have to add to FetchXml schema to include the first day X months ago, since it doesn't exist now. (Incidentally, the "Last Month" condition accomplishes what you're looking for, but it only does it for the last month, not for any Xth month ago.)
So I don't think it's possible to intercept the logic behind the "Last X Months" condition, as I'm betting it's wrapped in some core assembly somewhere. However, you can intercept the FetchXml passed to a subgrid via jscript or a report via the VB in the report builder. (It may also be possible for charts, but that's uncharted territory for me.)
对我来说,只要您了解这就是设计,并且 CRM 是迂腐的,它是从今天的日期和时间倒数过去两个月,而不是最后两个完整的日历月,那么这就是设计好的。
最好的替代方法是使用最后 X 个会计期间,并将您的会计设置设置为使用日历月。如果您在 CRM 中对财务期间没有任何其他目的(例如,您实际上并没有使用它来进行与每月周期以外的其他内容一致的财务报告),则将这些设置视为纯粹的“报告期间”并将其用于无论哪种方式都更方便。
会计期间是时间的“桶”,更像是一个类别轴 - 日期要么属于一个期间,要么属于另一个期间,它与您运行查询的当前日期/时间无关。
如果您想要前两个月加上当前月份的最新数据,请不要忘记在“本会计期间”中添加“或”条件。
(是的,我知道这个问题很老了,它显示在右侧,与我正在回答的另一个问题类似,我想我可以为以后访问同一页面的人提供帮助)
To me, this works as designed, as long as you understand this is the design and that CRM is pedantic about the last two months counting backwards from today's date and time, not the last two complete calendar months.
The best alternative is to use Last X Fiscal Periods instead, with your fiscal settings set to use calendar months. If you don't have any other purpose for Fiscal Periods in CRM (eg you are not actually using it to do financial reporting aligned to something other than a monthly cycle), then treat these settings as purely "Reporting Periods" and use them in whatever way is more convenient.
Fiscal Periods are "buckets" of time and are treated more like a category axis - a date either falls in one period or another, it does not relate to the current day/time you run the query.
If you want the previous two months plus current month to date, don't forget to put in an OR condition with This Fiscal Period as well.
(yes I know this question is very old, it showed up on the right as similar to another question I was answering, and I thought I could help out here for those who come to this same page later)