diff --git a/server-plugins/contact/src/utils.ts b/server-plugins/contact/src/utils.ts index 5478d89e3f..d5e951a7ab 100644 --- a/server-plugins/contact/src/utils.ts +++ b/server-plugins/contact/src/utils.ts @@ -80,10 +80,12 @@ export async function getAllSocialStringsByPersonId ( } export async function getPerson (control: TriggerControl, personId: PersonId): Promise { - const socialId = (await control.findAll(control.ctx, contact.class.SocialIdentity, { key: personId }))[0] + const socialId = ( + await control.findAll(control.ctx, contact.class.SocialIdentity, { _id: personId as SocialIdentityRef }) + )[0] if (socialId === undefined) { - control.ctx.error('Cannot find social id', { key: personId }) + control.ctx.error('Cannot find social id', { _id: personId }) return undefined } @@ -114,7 +116,9 @@ export async function getPersonsBySocialIds ( } export async function getEmployee (control: TriggerControl, personId: PersonId): Promise { - const socialId = (await control.findAll(control.ctx, contact.class.SocialIdentity, { key: personId }))[0] + const socialId = ( + await control.findAll(control.ctx, contact.class.SocialIdentity, { _id: personId as SocialIdentityRef }) + )[0] const employee = ( await control.findAll( control.ctx,