fix: Salesforce owner check, handle no contact email (#17834)

This commit is contained in:
Joe Au-Yeung
2024-11-25 19:38:06 +00:00
committed by GitHub
parent 7e0c684348
commit aea8588a21
@@ -23,7 +23,7 @@ export async function getCRMContactOwnerForRRLeadSkip(
const contact = await crmManager.getContacts({ emails: bookerEmail, forRoundRobinSkip: true });
const endTime = performance.now();
logger.info(`Fetching from CRM took ${endTime - startTime}ms`);
if (!contact?.length || !contact[0].email) return nullReturnValue;
if (!contact?.length || !contact[0].ownerEmail) return nullReturnValue;
return { email: contact[0].ownerEmail ?? null, recordType: contact[0].recordType ?? null, crmAppSlug };
}