function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sagar MauryaSagar Maurya 

Using the 'Parameterized Search' on Contact, I am getting unexpected result

While using the 'Parameterized Search' on Contact, I am getting unexpected result. I am using below json to search records on contact based on 'Name' filter:
{
"q":"CAPITAL CROSS",
"fields" : ["Id","FirstName","LastName","Account.Name"],
"sobjects":[{"name": "Contact", "where":"RecordType.Name='Internal'"}],
"in":"NAME"
}

Note - There is only one contact with name as 'CAPITAL CROSS'. And this contact is associated with account named as 'Capital'.

Expected -
When I run the above json as System Admin profile, I get only one contact named as 'CAPITAL CROSS'

Unexpected-
When I run the above json from custom profile having Salesforce Platform user license, I get 'CAPITAL CROSS' contact and all the other contacts which are associated with the same account named 'Capital' in response. This should not happen as I am getting all the contacts which are not matching my search criteria.

Can anyone help me in understanding that what could be reason for this behaviour?
SwethaSwetha (Salesforce Developers) 
HI Sagar,

I tried a narrowed down repro of the issue you mentioned in my dev org:

Repro
1. Login to workbench
2. Select Rest explorer and make a post call
3:- Use request URL as follow :-
/services/data/v45.0/parameterizedSearch
Below is the request body for POST Call


{"q":"Tim Barr",
"fields":["Id","FirstName","LastName","Account.Name"],
"in": "NAME",
"sobjects": [{"name":"Contact"}]
}

Result: I see that only one account is returned.

searchRecords
0037F000001W17wQAC
attributes
Id: 0037F000001W17wQAC
FirstName: Tim
LastName: Barr
Account
attributes
Name: Grand Hotels & Resorts Ltd

Note: This account has 4 contacts but only the one associated account is returned for above post call.

This does not appear to be a Bug or issue of Salesforce Platform level. It appears to be your org specific.
 
Hope this helps you. Please mark this answer as best so that others facing the
same issue
will find this information useful.
 
Thank you