locked
How to Obtain FetchXML from LayoutXML or ColumnsetXml RRS feed

  • Question

  • I have LayoutXml and ColumnsetXml.

    I need to obtain the FetchXML for the corresponding LayoutXml/ColumnsetXml.

    I need to obtain the fetchXML, modify it based on the requirement and execute it to obtain the value.

    Kindly let me know whether is it possible through any option.

    Is there any option like FetchXml to QueryExpression or something similar?

    Regards
    Vinoth

    Monday, September 27, 2010 1:11 PM

Answers

All replies

  • You can't fully derive FetchXml from LayoutXml and ColumnSetXml, as the latter have nothing about the filter criteria or linked entites.

    Where are you getting the LayoutXml and ColumnSetXml from ? If it's from a savedquery or userquery (and I'm not sure where else it could come from), you can execute the query by using the ExecuteByIdSavedQuery or ExecuteByIdUserQuery message

    What are you trying to achieve ?


    Microsoft CRM MVP - http://mscrmuk.blogspot.com  http://www.excitation.co.uk
    Tuesday, September 28, 2010 11:49 AM
    Moderator
  • Hi DavidJennaway

    Thanks for pointing me ExecuteByIdSavedQuery or ExecuteByIdUserQuery message.

    I am obtaining LayoutXml and ColumnSetXml values from SavedQuery and UserQuery alone, Hence your findings should help me.

    I was trying to acheive to obtain the fetchxml and reconstruct it based on the my condition and fetch values from it. I will try to acheive it using ExecuteByIdSavedQuery or ExecuteByIdUserQuery.

    Thankyou.

    Regards
    Vinoth

    Tuesday, September 28, 2010 12:02 PM
  • Hi DavidJennaway

    // Create the request.
    ExecuteByIdSavedQueryRequest query = new ExecuteByIdSavedQueryRequest();
    query.EntityId = new Guid("4463D991-F88C-4737-8D66-017C31C7B0ED");

    // Execute the request.
    ExecuteByIdSavedQueryResponse queried = (ExecuteByIdSavedQueryResponse) service.Execute(query);

    This method works for savedqueryid which contains fetchxml. It fails when the fetchxml is null. Error code 0x80040203.

    Do we need to set OptionalParameter for it?

    Regards
    Vinoth

     

    Tuesday, September 28, 2010 1:12 PM
  • Unfortunately it looks like this is a limitation of ExecuteByIdSavedQuery - I can't think of anything extra you can do to make this work


    Microsoft CRM MVP - http://mscrmuk.blogspot.com  http://www.excitation.co.uk
    Friday, October 22, 2010 11:12 AM
    Moderator
  • Hi DavidJennaway

    Thanks alot for getting back. Much appriciated.

    I too hope that its the limitation by ExecuteByIdSavedQuery and ExecuteByIdUserQuery. But I have a concern that it should not pop error if its a limitation.

    Is it a BUG?

    Regards
    Vinoth

    Friday, October 22, 2010 11:22 AM