Skip to main content
added 675 characters in body
Source Link
SFDC Neuf
  • 1.5k
  • 17
  • 32

One last thing - this succeeds:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

But this fails:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000SQyVGAA1')
            OR ParentId IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

So it appears that in order to cause the error, there needs to be both the contradictory statement and at least 2 other inclusion statements within the OR.

One last thing - this succeeds:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

But this fails:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000SQyVGAA1')
            OR ParentId IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

So it appears that in order to cause the error, there needs to be both the contradictory statement and at least 2 other inclusion statements within the OR.

deleted 3 characters in body
Source Link
SFDC Neuf
  • 1.5k
  • 17
  • 32

After a bit of investigation with explicitly stated IDs, I think I found the unique issue that causes the error, and it can be handled more elegantly than my workaround.

Upon further investigation, the error is only happening when accountIds is contains only opp.AccountId.

This fails:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000SQyVGAA1')
            OR ParentId IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

This succeeds:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            ParentId IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

And this also succeeds:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
        )
    ORDER By Name
]

So the it appears the parser has a hard time dealing with the contradictory inclusion statements. I can create a second set to eliminate the issue.

After a bit of investigation with explicitly stated IDs, I think I found the unique issue that causes the error, and it can be handled more elegantly than my workaround.

Upon further investigation, the error is only happening when accountIds is contains only opp.AccountId.

This fails:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000SQyVGAA1')
            OR ParentId IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

This succeeds:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            ParentId IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

And this also succeeds:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
        )
    ORDER By Name
]

So the it appears the parser has a hard time dealing with the contradictory inclusion statements. I can create a second set to eliminate the issue.

After a bit of investigation with explicitly stated IDs, I think I found the unique issue that causes the error, and it can be handled more elegantly than my workaround.

Upon further investigation, the error is only happening when accountIds contains only opp.AccountId.

This fails:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000SQyVGAA1')
            OR ParentId IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

This succeeds:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            ParentId IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

And this also succeeds:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
        )
    ORDER By Name
]

So the it appears the parser has a hard time dealing with the contradictory inclusion statements. I can create a second set to eliminate the issue.

Source Link
SFDC Neuf
  • 1.5k
  • 17
  • 32

After a bit of investigation with explicitly stated IDs, I think I found the unique issue that causes the error, and it can be handled more elegantly than my workaround.

Upon further investigation, the error is only happening when accountIds is contains only opp.AccountId.

This fails:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000SQyVGAA1')
            OR ParentId IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

This succeeds:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            ParentId IN ('0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000SQyVGAA1')
        )
    ORDER By Name
]

And this also succeeds:

[
    SELECT Name
    FROM Account
    WHERE Id != '0014000000SQyVGAA1'
        AND Id != null
        AND (
            Id IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
            OR Parent.Parent.Parent.ParentId IN ('0014000000VqDVWAA3','0014000000SQyVGAA1')
        )
    ORDER By Name
]

So the it appears the parser has a hard time dealing with the contradictory inclusion statements. I can create a second set to eliminate the issue.