locked
CRM Rest substringof(' % or _ or [ or ' ',Name) RRS feed

  • Question

  • I can't create REST query for search Accounts with Name which comprises symbols % or [ or ' or _

    Example:

    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof('%',Name)
    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof('_',Name)
    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof('[',Name)
    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof(''',Name)

    Friday, July 24, 2015 1:21 PM

Answers

  • Hello Maksym,

    So here is answer:

    for single quote - ' just replace it with 2 quotes like

    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof('''',Name)

    For all other items I haven't found quick answer. Will keep you updated if will find some.


    Dynamics CRM MVP
    My blog

    Friday, July 24, 2015 2:42 PM
    Moderator
  • Hello Andrii,

    For all other items, I found answer self. 
    You have to replace % to [%]

    Example:

    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof('[%]',Name)
    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof('[_]',Name)
    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof('[[]',Name)

    Monday, July 27, 2015 11:04 AM

All replies

  • Hello Maksym,

    So here is answer:

    for single quote - ' just replace it with 2 quotes like

    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof('''',Name)

    For all other items I haven't found quick answer. Will keep you updated if will find some.


    Dynamics CRM MVP
    My blog

    Friday, July 24, 2015 2:42 PM
    Moderator
  • Hello Andrii,

    For all other items, I found answer self. 
    You have to replace % to [%]

    Example:

    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof('[%]',Name)
    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof('[_]',Name)
    /XRMServices/2011/OrganizationData.svc/AccountSet()?$orderby=Name&$select=AccountId,Name&$filter=substringof('[[]',Name)

    Monday, July 27, 2015 11:04 AM
  • It would be good to post all the existing replacements you've found.

    Dynamics CRM MVP
    My blog

    Monday, July 27, 2015 11:13 AM
    Moderator