pipedrive-dotnet icon indicating copy to clipboard operation
pipedrive-dotnet copied to clipboard

Search Organization by custom fields

Open Maruga opened this issue 3 years ago • 2 comments

hi, I want to search for an organization through a custom field, but it finds me all the organizations that contain 70, I tried to enter ExactMatch both true and false but it doesn't work. Any suggestions? thank you very much

        Dim filtriRicerca As New OrganizationSearchFilters()
        filtriRicerca.Parameters.Add("custom_fields", "COD. CLIENTE")
        Dim Organizations = Await Pipedrive.Organization.Search("70", filtriRicerca)

Maruga avatar Jun 30 '21 19:06 Maruga

Hi, you can't search by a specific custom field: https://developers.pipedrive.com/docs/api/v1/Deals#searchDeals. However, I'll add the news fields parameter which allows to specify the fields to perform the search from.

DavidRouyer avatar Jul 05 '21 12:07 DavidRouyer

IIRC you can't add parameters in that way. They are generated when you set other fields. If you breakpoint your code before calling the search, you'll see that your parameters didn't add.

Try this. You may need to do your own filtering once you get search results, depending on what you're searching.

var searchQuery = new DealSearchFilters();
searchQuery.OrganizationId = crmOrg.Id;
searchQuery.Fields = DealSearchField.custom_fields;
var searchResults = await _pipedriveClient.Deal.Search("your custom field value", searchQuery);

dombarnes avatar Jan 26 '22 09:01 dombarnes