APIs & Integrations

RBop
Member

Unable to infer object type from: {ID}

Hello !

I was prove to do an association between a deal and a contact after creating the deal. But the response is : Unable to infer object type from: userId...

I don't understand what is wrong on my code... Maybe somebody have best eyes :

thank you !

const theMerchant = await this.userService.findOne({ where: { id: merchantId } })
            const createDeals = await this.hubspotService.getService().crm.deals.basicApi.create({
               properties: { 
                  amount: `${event.amount / 100}`,
                  dealname: event.description,
                  dealstage: "presentationscheduled",
                  pipeline: "default",
                  nom_vendeur: `${theMerchant.firstname} ${theMerchant.lastname}`,
                  nom_acheteur: `${user.firstname} ${user.lastname}`,
                  type_de_livraison: 'transporter',
                  dealtype: 'sale',
                  etat: "0",
               },
            })
            await this.hubspotService.getService().crm.deals.associationsApi.create(createDeals.id, theMerchant.hubspotUserId, "USER_DEFINED", "3")

 

0 Upvotes
1 Reply 1
Jaycee_Lewis
Community Manager
Community Manager

Unable to infer object type from: {ID}

Hey, @RBop 👋 To clarify, you are using the Associations v4 | Create endpoint, correct?

PUT /crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}/{toObjectId}

 

Can you try a simpler approach and test using the example from the above link? Can you successfully create an association there? Posting your request and the response body along with the full error will help our community members know how and where they can assist you.

 

Best,

Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes