I’m making a custom floating window app and the project is based on the react pipedrive phone call template.
I would need to make a post Organization. The post organization method works, but
I dont know how to fill the other custom data fields:
I can get the ID of the customized field but even If I change the “nip” to the apki key it still wont post the neccessary data.
Here is my code:
import { OrganizationsApi, OrganizationFieldsApi, NewOrganization } from 'pipedrive';
import logger from '../../shared/logger';
import { getAPIClient } from '../../shared/oauth';
const log = logger('Get Organization API 📚');
const handler = async (req, res) => {
try {
const d = req.body;
const client = getAPIClient(req, res);
log.info('Initializing client');
const api = new OrganizationsApi(client);
const newOrganization = await api.addOrganization(
NewOrganization.constructFromObject({
name: d.name,
address: d.address,
nip: d.nip,
})
);
const organization = newOrganization.data;
log.info('Returning response');
res.status(200).json(organization);
} catch (error) {
log.info('Failed posting organization');
log.error(error);
res.status(500).json({ success: false, data: error });
}
};
Can someone give me a hint how to modify this request in order to post to a custom field?