Skip to content

toLabel function is parsed as a field in the WHERE clause #23

@ABenassi87

Description

@ABenassi87
  • Feature
  • Bug Request

Description

I tried to parse this SOQL:

SELECT Company, toLabel(Status)
FROM Lead
WHERE toLabel(Status) = 'le Draft'

I took this soql query from: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_tolabel.htm

Result;

{
    "fields": [
        {
            "text": "Company"
        },
        {
            "fn": {
                "text": "toLabel(Status)",
                "name": "toLabel",
                "parameter": "Status"
            }
        }
    ],
    "subqueries": [],
    "sObject": "Lead",
    "whereClause": {
        "left": {
            "field": "toLabel(Status)",
            "operator": "=",
            "value": "'le Draft'"
        }
    }
}

The toLabel(status) function in the WHERE clause is parsed as a field. I think that it should be parsed as a function as it happens in the SELECT clause.

Expected result:

{
    "fields": [
        {
            "text": "Company"
        },
        {
            "fn": {
                "text": "toLabel(Status)",
                "name": "toLabel",
                "parameter": "Status"
            }
        }
    ],
    "subqueries": [],
    "sObject": "Lead",
    "whereClause": {
        "left": {
             "fn": {
                "text": "toLabel(Status)",
                "name": "toLabel",
                "parameter": "Status"
            },
            "operator": "=",
            "value": "'le Draft'"
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions