locked
FetchXML parameter question? RRS feed

  • Question

  • I am attemting to attach a parameter to my report.  It will not allow me to make it searchable by the user name, instead it is requireing me to enter the user id.  This is not an option, considering the user ID's are 32 characters long with multiple dashes.  How do I set it to look-up by the user name.  This is the erros I recieve;

    An exception System.FormatException was thrown while trying to convert input value"" to attribute'contact.ownerid'.  Expected type of attribute value: Exception raised: Guid should contain 32 digits with 4 dashes

    Wednesday, May 22, 2013 3:28 PM

Answers

  • Perhaps the easiest way would be to join from the user entity to the related entity (account in my example below)

    <fetch distinct="false" no-lock="false" mapping="logical"><entity name="systemuser">
    <attribute name="systemuserid" />
    <attribute name="fullname" />
    <filter type="and">
    <condition attribute="fullname" operator="eq" value="@username"/>
    </filter>
    <link-entity name="account" to="systemuserid" from="owninguser" link-type="outer" alias="account1" ><attribute name="name" alias="account1_name" />
    <attribute name="accountid" />
    </link-entity>
    </entity>
    </fetch>

    You could also use pre-filtering so that the report could be run directly from the user record in CRM.

    Also you could add a report parameter that get's it's values from a fetchxml query that returns all users - then the value selected would actually be the systemuserid already.

    hth


    Scott Durow
    Read my blog: www.develop1.net/public     Follow Me on Twitter
    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    • Proposed as answer by James Reinhardt Wednesday, May 22, 2013 8:42 PM
    • Marked as answer by Gregfoulk79 Tuesday, May 28, 2013 12:45 PM
    Wednesday, May 22, 2013 5:42 PM
    Answerer