Error Creating Filter Templates

Jan 16, 2012 at 5:53 PM

Hi all,

I'm following the part IV of your great article Views and Local Data Group.

I have configured the Deploy Offline Filter Template workflow, but when I tried to run it I have this exception.

Could you help me?

Thanks in advance,

Regards,

System.Runtime.Serialization.SerializationException: There was an error deserializing the object of type Microsoft.Xrm.Sdk.Entity. Data at the root level is invalid. Line 1, position 1. ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1. at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.XmlReader.MoveToContent() at System.Xml.XmlReader.IsStartElement(String localname, String ns) at System.Runtime.Serialization.XmlObjectSerializer.IsRootElement(XmlReaderDelegator reader, DataContract contract, XmlDictionaryString name, XmlDictionaryString ns) at System.Runtime.Serialization.DataContractSerializer.InternalIsStartObject(XmlReaderDelegator reader) at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) --- End of inner exception stack trace --- at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlReader reader) at Gemina.CRM2011.WF.LdgManager.AgCodeActivityBase.DeserializeEntity(String str) at Gemina.CRM2011.WF.LdgManager.AgDeploySystemView.CreateEntity() at Gemina.CRM2011.WF.LdgManager.AgDeploySystemView.ExecuteBody(CodeActivityContext executionContext) at Gemina.CRM2011.WF.LdgManager.AgCodeActivityBase.Execute(CodeActivityContext executionContext)

 

Unhandled Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: System.Runtime.Serialization.SerializationException: There was an error deserializing the object of type Microsoft.Xrm.Sdk.Entity. Data at the root level is invalid. Line 1, position 1. ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
   at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
   at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlReader.MoveToContent()
   at System.Xml.XmlReader.IsStartElement(String localname, String ns)
   at System.Runtime.Serialization.XmlObjectSerializer.IsRootElement(XmlReaderDelegator reader, DataContract contract, XmlDictionaryString name, XmlDictionaryString ns)
   at System.Runtime.Serialization.DataContractSerializer.InternalIsStartObject(XmlReaderDelegator reader)
   at System.Runtime.Serialization.DataContractSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   --- End of inner exception stack trace ---
   at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)
   at System.Runtime.Serialization.DataContractSerializer.ReadObject(XmlReader reader)
   at Gemina.CRM2011.WF.LdgManager.AgCodeActivityBase.DeserializeEntity(String str)
   at Gemina.CRM2011.WF.LdgManager.AgDeploySystemView.CreateEntity()
   at Gemina.CRM2011.WF.LdgManager.AgDeploySystemView.ExecuteBody(CodeActivityContext executionContext)
   at Gemina.CRM2011.WF.LdgManager.AgCodeActivityBase.Execute(CodeActivityContext executionContext)
   at Gemina.CRM2011.WF.LdgManager.AgCodeActivityBase.Execute(CodeActivityContext executionContext)
   at Gemina.CRM2011.WF.LdgManager.AgDeploySystemView.Execute(CodeActivityContext executionContext)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

 

Jan 31, 2012 at 2:11 PM

Hi really apologise for this late response. Sorry to see you have a problem with this plugin - Is this still happening? If so, can you please tell me which view / template you are trying to deploy? It would helpful if you could provide the FetchXML and the LayoutXML of the view.

Many thanks!

Feb 3, 2012 at 1:37 PM

Hi gemina,

It's still happening! Our first test it was with an own entity and view called "Todos los Pedidos".

These are the Fetch & Layout XML.

Many many thanks!

FetchXML

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="tim_pedido"><attribute name="tim_fechadepedido" /><attribute name="tim_fechadeentrega" /><attribute name="tim_precampana" /><attribute name="tim_transporte" /><attribute name="tim_origen" /><attribute name="tim_name" /><order attribute="tim_fechadepedido" descending="true" /><order attribute="tim_fechadeentrega" descending="true" /><filter type="and"><filter type="and"><condition attribute="statecode" operator="eq" value="0" /><condition attribute="tim_estado" operator="eq" value="1" /></filter></filter><link-entity name="tim_distribuidor" from="tim_distribuidorid" to="tim_clienteid" visible="false" link-type="outer" alias="a_6fa249f931c3e011bbf000155dc8963b"><attribute name="tim_name" /></link-entity><link-entity name="tim_formadepago" from="tim_formadepagoid" to="tim_formadepagoid" visible="false" link-type="outer" alias="a_5912d68832c3e011bbf000155dc8963b"><attribute name="tim_name" /><attribute name="tim_codigo" /></link-entity><link-entity name="systemuser" from="systemuserid" to="tim_atcid" visible="false" link-type="outer" alias="a_37e92c3332c3e011bbf000155dc8963b"><attribute name="fullname" /></link-entity><attribute name="tim_consignatario" /><link-entity alias="a_760ecec82cc3e011bbf000155dc8963b" name="systemuser" from="systemuserid" to="owninguser" link-type="outer" visible="false"><attribute name="fullname" /></link-entity><attribute name="tim_pedidoid" /></entity></fetch>

Layout XML

<grid name="resultset" object="10041" jump="tim_name" select="1" icon="1" preview="1"><row name="result" id="tim_pedidoid"><cell name="tim_fechadepedido" width="100" /><cell name="tim_fechadeentrega" width="100" /><cell name="a_6fa249f931c3e011bbf000155dc8963b.tim_name" width="150" disableSorting="1" /><cell name="a_37e92c3332c3e011bbf000155dc8963b.fullname" width="150" disableSorting="1" /><cell name="tim_consignatario" width="150" /><cell name="tim_precampana" width="100" /><cell name="a_5912d68832c3e011bbf000155dc8963b.tim_codigo" width="150" disableSorting="1" /><cell name="a_5912d68832c3e011bbf000155dc8963b.tim_name" width="150" disableSorting="1" /><cell name="tim_origen" width="100" /><cell name="tim_transporte" width="100" /><cell name="tim_name" width="100" /><cell name="a_760ecec82cc3e011bbf000155dc8963b.fullname" width="200" disableSorting="1" /></row></grid>

Feb 3, 2012 at 5:46 PM

Thank you! So, The problem seems to be with the "View Definition" input parameter of the AgDeploySystemView activity. For some reason whatever is in that field is not a valid XML file. If you followed the instructions in the article, that field should contain the output from a "Retrieve View" activity, which is delivered in its "View Definition" output parameters.

Bear with me, it is difficult to "remote debug" like this, but could you possibly make sure that the "Retrieve View" activity was successful and actually found the view you were looking for? There is another output parameter in "Retrieve View", called "Count of Views". This should be equal to 1. If it's 0 then the view was not found, if it's 2 or more multiple views were found.

If you can, add a condition check between the Retrieve View and the Deploy View that tests for the value of "Count of Views" and passes only if it's = 1.

If this is still not the problem, it would be very useful to see what actually is in the "View Definition" output parameter of the Retrieve View activity, and a (moderately) straightforward way to check this is by having the workflow create a note or an activity (such as an email) with the body set to the output of "View Definition".

Not sure what's your level of familiarity with these topics, so I don't know if you are following me, but I truly appreciate your help in getting to the bottom of this ;-)