Closed evagelos21 closed 3 years ago
Is "DETAIL" your custom field name? I suspect it is and you should use custom field key instead of name. You can query all organization fields and find field key by name.
No, my custom field name is "Country Name" I cannot understand how to c# coding !!! i have managed to add NEW Organization, but i cannot understand how to update
Take a look at the Pipedrive REST API: https://developers.pipedrive.com/docs/api/v1/
If you create a custom field on Pipedrive, Pipedrive will generate a unique API key for your field which look like 034b2499f80a0b36c289efb7811f842bf22fd998
and can be found on the Data fields section in the settings UI.
You can also fetch them by using the https://developers.pipedrive.com/docs/api/v1/#!/OrganizationFields endpoint.
var organization = await client.Organization.Get(1);
// Address is a default organization field created by Pipedrive so you have access to it
Console.WriteLine($"Address: {organization.Address}");
Console.WriteLine($"FormattedAddress: {organization.AddressFormattedAddress}");
Console.WriteLine($"StreetNumber: {organization.AddressStreetNumber}");
Console.WriteLine($"Route: {organization.AddressRoute}");
Console.WriteLine($"Country: {organization.AddressCountry}");
// ...
var updatedOrganisation = organization.ToUpdate();
updatedOrganisation.CustomFields["address"] = new AddressCustomField("2, avenue des Champs Elysées, Paris, France", "", "2", "rue des Champs Elysées", "", "", "", "", "", "", "2, avenue des Champs Elysées, Paris, France");
// Get your organization field API key
// updatedOrganisation.CustomFields["your-field-api-key"] = new StringCustomField("0606060606");
await client.Organization.Edit(organization.Id, updatedOrganisation);
Thanks, now it seams easy to me
This seems a bit confusing tbh. Address is not a custom field yet we behave like it is one. According to some posts to the Pipedrive community, when you send an "address" field, it will auto-parse the string you give and work out the split address fields (via Google API's). So if I send "1 High Street, New Town, New State" it works out 1 High Street is line 1. So it would be useful to have a constructor for AddressCustomField that takes a single string to send to address. If I'm doing this in Postman, I just send
{
"address": "1 High Street, New Town, New State"
}
Annoyingly the official docs lack any kind of proper documentation for this https://developers.pipedrive.com/docs/api/v1/Organizations#updateOrganization Doesn't indicate thats how you update any field (and neither does their Postman config file). https://devcommunity.pipedrive.com/t/address-in-organization-api/1391/10
Follow up observation. It looks like the pipedrive API ignores setting other address fields. For example sending an address
and an address_street_number
, the address_street_number
is ignored (or overridden) if I set it to something that doesn't match the address
. Similarly, you can't just send address_street_number
as it returns a 400 bad request.
So sending anything beyond address
is redundant it seems.
Im trying like this but no luck: What am i missing?