CMS Development

NickPrice
Member | Elite Partner
Member | Elite Partner

crm_associations custom objects empty

SOLVE

Hi

 

I'm trying to pull out associations between two custom object types (workshop and trainer), in hubl.

 

{% set trainerAssoc = crm_associations(workshop.id,"USER_DEFINED",49) %}

 

This is working correctly for one workshop, but returning an empty result for another workshop.

 

Both workshops have a trainer associated with them.

A test API call IS returning a result as such: 

https://api.hubspot.com/crm/v4/objects/2-109715420/622682310/associations/2-108618361

{
    "results": [
        {
            "toObjectId"475685066,
            "associationTypes": [
                {
                    "category""USER_DEFINED",
                    "typeId"49,
                    "label"null
                }
            ]
        }
    ]
}

 

but, there are no results via the crm_associations method for the exact same object.

 

Why could this be happening?

Thanks

0 Upvotes
2 Accepted solutions
Kevin-C
Solution
Recognized Expert | Partner
Recognized Expert | Partner

crm_associations custom objects empty

SOLVE

Hey  @NickPrice 

 

It is possible that this is a bug! We've seen this happen in multiple portals at Impulse Creative. Notably portals that predated custom associations and/or association labels. I would collect this information and relay it to the support team via a ticket. With enough information the HS team is usually able to figure out whats going on and get it fixed within a few days.

 

But there is good news, if you switch from using the crm_associations function to GraphQL to retrieve the association data, you can circumvent the issue.

 

If I can help answer any queestions please don't hesitate to reach out

Best

Kevin-C

View solution in original post

0 Upvotes
NickPrice
Solution
Member | Elite Partner
Member | Elite Partner

crm_associations custom objects empty

SOLVE

Hey @Kevin-C 

 

Thanks for much for replying and pointing me in the right direction!

Using the debug function I was finally able to see the problem - I was maxing out calls to the crm_associations function, as I was looping through too many times in my code. Hence why it worked once in the page but was empty further down.

I hadn't played with GraphQL  before - but thanks to your suggestion I've rewritten the module using a graphQL query to retrieve all the data in one go - and it's now working fantastically.

 

Thanks again for your help!

Nick

View solution in original post

0 Upvotes
3 Replies 3
Kevin-C
Solution
Recognized Expert | Partner
Recognized Expert | Partner

crm_associations custom objects empty

SOLVE

Hey  @NickPrice 

 

It is possible that this is a bug! We've seen this happen in multiple portals at Impulse Creative. Notably portals that predated custom associations and/or association labels. I would collect this information and relay it to the support team via a ticket. With enough information the HS team is usually able to figure out whats going on and get it fixed within a few days.

 

But there is good news, if you switch from using the crm_associations function to GraphQL to retrieve the association data, you can circumvent the issue.

 

If I can help answer any queestions please don't hesitate to reach out

Best

Kevin-C

0 Upvotes
NickPrice
Solution
Member | Elite Partner
Member | Elite Partner

crm_associations custom objects empty

SOLVE

Hey @Kevin-C 

 

Thanks for much for replying and pointing me in the right direction!

Using the debug function I was finally able to see the problem - I was maxing out calls to the crm_associations function, as I was looping through too many times in my code. Hence why it worked once in the page but was empty further down.

I hadn't played with GraphQL  before - but thanks to your suggestion I've rewritten the module using a graphQL query to retrieve all the data in one go - and it's now working fantastically.

 

Thanks again for your help!

Nick

0 Upvotes
Jaycee_Lewis
Community Manager
Community Manager

crm_associations custom objects empty

SOLVE

Hi, @NickPrice 👋 Thanks for your question! I'd like to invite some of our community members to join the converstaion — hey @albertsg @Anton @Stephanie-OG, do you have any troubleshooting tips or HubL wisdom you can share with @NickPrice?

 

Thank you very much for taking a look! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes