Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

AddCustomView gives XML reference error

Posted on by 115

Hi, i want to addcustomview to my look up field. But its give me XML reference error. Could you tell me where is the mistake within my code:

Fetch XML:

"<fetch>"+
"<entity name='lnkt_damage' >"+
"<attribute name='lnkt_damageid' alias='DamageId' />"+
"<attribute name='lnkt_name' alias='DamageName' />"+
"<attribute name='lnkt_subdevicename' alias='SubDeviceName' />"+
"<attribute name='lnkt_device' alias='DeviceName' />"+
"<attribute name='createdon' alias='CreatedOn' />"+
"<filter>"+
"<condition attribute='lnkt_device' operator='eq' value='"+device_id+"' />"+
"<condition attribute='lnkt_subdevicename' operator='eq' value='"+subdevice_id+"' />"+
"</filter>"+
"</entity></fetch>"

Layout XML:

"<grid name='resultset' "+"object='1' " + "jump='lnkt_name' " + "select='1' " + "icon='1' " + "preview='2'>" +
"<row name='result' " + "id='lnkt_damageid'>" +
"<cell name='lnkt_name' " + "width='150' />" +
"<cell name='lnkt_subdevicename'" + "width='150' />" +
"<cell name='lnkt_device'" + "width='150' />" +
"<cell name='createdon' " + "width='100' />" + "</row>" +"</grid>"

i have make sure that the fetch XML working fine through FetchXMLBuilder

*This post is locked for comments

  • FikriHailal Profile Picture
    FikriHailal 115 on at
    RE: AddCustomView gives XML reference error

    Hi goutam, i have find a solution for this. Actually  my fetchXML is good. The problem is within layoutXML. I just remove one of the cell name, and everything goes well

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: AddCustomView gives XML reference error

    Hi ,

    Could you please remove the alias name from XML and also put and condition in the filter. 

    "<fetch version='1.0'" +
    " mapping='logical'" +
    " output-format='xml-platform'" +
    " distinct='false'>" +
    "<entity name='lnkt_damage'>" +
    "<attribute name='lnkt_name'/>" +
    "<attribute name='lnkt_subdevicename'/>" +
    "<attribute name='lnkt_device' />" +
    "<attribute name='createdon'/>" +
    "<filter type='and'>" +
    "<condition attribute='lnkt_device' operator='eq' value='" + device_id + "' />" +
    "<condition attribute='lnkt_subdevicename' operator='eq' value='" + subdevice_id + "' />" +
    "</filter>" +
    "</entity></fetch>"

    Here is sample code you can have a look .

    https://www.inogic.com/blog/2014/09/add-custom-view-in-lookup-and-disable-all-the-other-views/

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans