D365 Finance & Operations and Dynamics AX Forum

 View Only
  • 1.  Odata filter query in PowerShell for Dynamics 365

    Posted Jul 18, 2022 11:56 AM
    Writing a script for a pipleline and trying to use a filter on a oData query for D365 F&O data entity however can't seem to get it to work. I get results without filter however what i'm trying to do is use a EQ operator to filter based on a string value. I've tried double quotes, single quotes but none seem to work. Below is the specific line from my PowerShell script

    Get-D365ODataEntityData -EntityName SecurityUserRoleAssociations-Token $token -ODataQuery '$filter=UserID eq "ABC"' 
    

    Please let me know if anyone has any suggestions. Thanks!

    Regards,
    Raheel



    ------------------------------
    Raheel Rao
    Hickory Farms
    IL
    ------------------------------


  • 2.  RE: Odata filter query in PowerShell for Dynamics 365

    SILVER CONTRIBUTOR
    Posted Jul 19, 2022 09:22 AM
    Have you tried using -eq instead of eq ?

    ------------------------------
    Thomas Laza
    South Texas Electric Cooperative Inc
    Nursery TX
    ------------------------------



  • 3.  RE: Odata filter query in PowerShell for Dynamics 365

    Posted Jul 25, 2022 10:48 AM
    Hi Thomas,

    Tried that too and unfortunately that didn't work either.

    ------------------------------
    Raheel Rao
    ECCO
    IL
    ------------------------------



  • 4.  RE: Odata filter query in PowerShell for Dynamics 365

    SILVER CONTRIBUTOR
    Posted Jul 25, 2022 11:53 AM
    Is it possible the filter is case sensitive? If so, you might try all caps on the UserID, or some variation of upper case and lower case.

    ------------------------------
    Thomas Laza
    South Texas Electric Cooperative Inc
    Nursery TX
    ------------------------------



  • 5.  RE: Odata filter query in PowerShell for Dynamics 365

    Posted Jul 26, 2022 07:48 AM
    It's definitely case sensitive. It should be UserId. Also I'm not 100% on this, but you may need to use single quotes to escape single quotes, so your filter would look like this
    '$filter=UserId eq ''ABC'''​


    ------------------------------
    Lenny Kaplan
    Warburg Pincus LLC
    New York NY
    ------------------------------



If you've found this thread useful, dive deeper into User Group community content by role