Dynamics 365 CRM按用户类型筛选:排除应用用户的方法
在Dynamics 365 CRM中可靠排除应用用户的FetchXML方案
好问题!你之前尝试用type字段过滤应用用户的思路方向是对的,但其实Dynamics 365 CRM提供了一个更稳定、不受语言环境影响的确定性字段来识别应用用户——那就是isapplicationuser(逻辑名),它是一个布尔类型的系统字段。
为什么不推荐依赖type字段?
type是一个选项集字段,它的显示值(比如"App User")会随着环境的语言设置变化(例如中文环境下会显示为"应用用户"),如果你的CRM环境切换语言,原来的筛选条件就会失效。而isapplicationuser是纯粹的布尔值:
true(或值1):表示该用户是应用用户false(或值0):表示该用户是普通系统用户
修改后的FetchXML代码
把你的过滤条件替换为isapplicationuser的判断,就能准确排除所有应用用户:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"> <entity name="systemuser"> <attribute name="fullname" /> <attribute name="businessunitid" /> <attribute name="title" /> <attribute name="address1_telephone1" /> <attribute name="positionid" /> <attribute name="systemuserid" /> <order attribute="fullname" descending="false" /> <filter type="and"> <!-- 筛选非应用用户 --> <condition attribute="isapplicationuser" operator="eq" value="0" /> </filter> </entity> </fetch>
额外说明
如果你需要更严谨的筛选,也可以同时结合type字段的条件,但优先级一定要以isapplicationuser为主,避免因选项集值变更导致的筛选错误。
内容的提问来源于stack exchange,提问作者Dalsier
相关产品推荐
相关产品推荐

