Skip to content

Commit 51b4f6b

Browse files
committed
updates
1 parent aa97d2b commit 51b4f6b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

components/pipedrive/common/utils.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,21 @@ export const formatCustomFields = async (resp, getResourcesFn, getFieldsFn) => {
6363
const customFieldNames = await getCustomFieldNames(getFieldsFn);
6464

6565
return resp.data.items.map((person) => {
66-
if (!person.item?.custom_fields?.length) {
66+
if (!person.item?.custom_fields || Object.keys(person.item.custom_fields).length === 0) {
6767
return person;
6868
}
6969
const { custom_fields: customFields } = persons.find((p) => p.id === person.item.id);
70+
if (!customFields || Object.keys(customFields).length === 0) {
71+
return person;
72+
}
7073
const formattedCustomFields = {};
7174
Object.entries(customFields).forEach(([
7275
key,
7376
value,
7477
]) => {
75-
formattedCustomFields[customFieldNames[key]] = value;
78+
if (customFieldNames[key]) {
79+
formattedCustomFields[customFieldNames[key]] = value;
80+
}
7681
});
7782
return {
7883
...person,

0 commit comments

Comments
 (0)