View Showing Accounts that don't have contact

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 07:12:24

问题


I want to create two views. - One view showing all accounts having contacts. It is easy. I don't have any issue with this. - Second View Showing All Accounts don't have any contact.

As we can't specify such condition for second view in advance find. Is there any way we can achieve this using Views?

I don't want to create SSRS report or any custom Development.

Please let me know if this is achievable.


回答1:


You can achieve this only by modifying the Account entity customization xml.

  1. Create a new (system) view for Account and name it "Active Accounts without Contacts".

  2. Create a (unmanaged) solution for export and add the Account entity without any dependencies.

  3. Export the solution and unpack the zip archive.

  4. Open the customization.xml with the editor of your choice.

  5. Modify the views FetchXml as follows:

before

...
<fetchxml>
  <fetch version="1.0" output-format="xml-platform" mapping="logical">
    <entity name="account">
      <attribute name="accountid" />
      <order attribute="name" descending="false" />
    </entity>
  </fetch>
</fetchxml>
<IntroducedVersion>1.0.0.0</IntroducedVersion>
  <LocalizedNames>
    <LocalizedName description="Active Accounts without Contacts" languagecode="1033" />
  </LocalizedNames>
  <Descriptions>
    <Description description="Active Accounts without Contacts" languagecode="1033" />
  </Descriptions>
...

after

<fetchxml>
  <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
    <entity name="account">
      <attribute name="accountid" />
      <order attribute="name" descending="false" />
      <link-entity name="contact" from="parentcustomerid" to="accountid" link-type="outer"/>
      <filter type="and"> 
        <condition attribute="parentcustomerid" operator="null" />
      </filter>
    </entity>
  </fetch>   
</fetchxml>
<IntroducedVersion>1.0.0.0</IntroducedVersion>
  <LocalizedNames>
    <LocalizedName description="Active Accounts without Contacts" languagecode="1033" />
  </LocalizedNames>
  <Descriptions>
    <Description description="Active Accounts without Contacts" languagecode="1033" />
  </Descriptions>
...

Finally, re-package the solution, import and publish.




回答2:


I could not get this to work, and after quite a bit of "tinkering" altered the fetchxml as follows and it works! I basically moved the filter to before the link-entity detail. This is on CRM2013 with Rollup 1.

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
  <entity name="account" >
    <attribute name="address1_city" />
    <filter type="and" >
      <condition entityname="contact" attribute="parentcustomerid" operator="null" />
    </filter>
    <link-entity name="contact" from="parentcustomerid" to="accountid" link-type="outer" />
    <attribute name="primarycontactid" />
    <order attribute="name" descending="false" />
    <attribute name="telephone1" />
    <attribute name="accountid" />
  </entity>
</fetch>


来源:https://stackoverflow.com/questions/23487235/view-showing-accounts-that-dont-have-contact

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!