pipedrive-dotnet
pipedrive-dotnet copied to clipboard
Search Organization by custom fields
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)
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.
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);