locked
Hey Guido, need a little help on FormXML field RRS feed

  • Question

  • Guido, I've been at this for day - I saw your reply to someone else about the formXML field in CRM, I'm a little stuck in trying to parse it in C#, I've never done it. Basically here is a picture: http://i.imgur.com/L7hSgEn.png

    I am trying to get all the the tab names, section names and datafield names and just print them out to the console. Would appreciate any advice or code snippet you could provide. The formXML data is stored in a string "xmlformdata" - just need to know how to get those values highlighted.

    Thanks mate.

    Friday, September 18, 2015 2:13 PM

All replies

  • Hi! I don't know if I am the Guido you are looking for :)

    However, in this scenario I will proceed in this way, I will create a C# class using xsd.exe in order to get a class based on the xml (you can use also a visual studio command)

    in this stackoverflow question you will find both methods

    http://stackoverflow.com/questions/3187444/convert-xml-string-to-object

    So after you have the class (as showed inside SO link) you will use XmlSerializer like

    XmlSerializer serializer = new XmlSerializer(typeof(msg)); MemoryStream memStream = new MemoryStream(Encoding.UTF8.GetBytes(inputString)); msg resultingMessage = (msg)serializer.Deserialize(memStream);

    and you class will be something like myObject.tabs[0].tab.columns[0].column so you will be able to navigate inside the structure


    My blog: www.crmanswers.net - CRM Theme Generator

    Friday, September 18, 2015 2:46 PM
  • Lol, it's you - There is only one Guido. You're known all over LinkedIn. 

    Thank you Guido.. I'll check this out after work.

    Friday, September 18, 2015 2:49 PM