Update custom person field

Hello
i am trying to update the custom person field which is of the type text from node js what is the body parameter i need to pass since in the docs i found out only for set or enum in which we will be giving out options but what parameter i should pass for the type text

Hey @kevin_joseph

By node.js, are you referring to the API client? If it is of type text you can pass the value directly. Do you face any challenges when you do that ? :thinking:

yes i am unable to update the custom field using api client
i have tried to update using the custom field api key which is personfield custom text field
i have used this api client-nodejs/PersonFieldsApi.md at master · pipedrive/client-nodejs · GitHub

Hey @kevin_joseph
Thanks for being patient! We have added Node.js samples that covers this :slight_smile:

More info can be found here Updating custom fields' values

const pipedrive = require('pipedrive');
const defaultClient = pipedrive.ApiClient.instance;

// Configure authorization by settings api key
// PIPEDRIVE_API_KEY is an environment variable that holds real api key
defaultClient.authentications.api_key.apiKey = process.env.PIPEDRIVE_API_KEY;
 
async function updatingCustomFieldValue() {
    try {
        console.log('Sending request...');
        
        const DEAL_ID = 158; // An ID of Deal which will be updated
        const fieldsApi = new pipedrive.DealFieldsApi();
        const dealsApi = new pipedrive.DealsApi();

        // Get all Deal fields (keep in mind pagination)
        const dealFields = await fieldsApi.getDealFields();
        // Find a field you would like to set a new value to on a Deal
        const appointedManagerField = dealFields.data.find(field => field.name === 'Appointed manager');

        const updatedDeal = await dealsApi.updateDeal(DEAL_ID, {
            [appointedManagerField.key]: 'Batman'
        });

        console.log('The value of the custom field was updated successfully!', updatedDeal);
    } catch (err) {
        const errorToLog = err.context?.body || err;

        console.log('Updating failed', errorToLog);
    }
}

updatingCustomFieldValue();

For my understanding, this updates a custom field of a deal.

Can we update a customfield of a person?

Hi @chriswolf
It should be possible via methods specific to PersonFields API :slight_smile:

https://www.postman.com/pipedrive-developers/workspace/86dfbf1b-5b49-49e8-b6e7-7010921f2741/request/14918448-e048cbc1-291d-4c36-a4ee-a2a0f1eab910

1 Like