CRM deal_product_id returns null and has_product as true

I’m trying to get product information from a deal in CRM from a front-end app using the request method, as show in the code.

const { response } = await client.request.get(
      `${https://mydomain.freshworks.com/crm/sales/api/deals}/${dealId}?include=deal_product`,
      {
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Token token=${token}`,
        },
      },
    );

The response show the has_product variable as true, but the deal_product_id comes null. Beside that, the deal_products array (from include=deal_product) comes empty.

image

Is this a bug in my code or an API error?

Hi @Matozinho ,
Good Day!
seems like the code you wrote is not in the correct format :thinking:
I think there is a problem with your destructuring the requestAPI response,

can you please try with the below snippet and do let me know if it does not work?

const response = await client.request.get(
      `${https://mydomain.freshworks.com/crm/sales/api/deals}/${dealId}?include=deal_product`,
      {
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Token token=${token}`,
        },
      },
    );

Hope it helps :slight_smile:

Thanks

1 Like

Hi @Santhosh, Good Day :grinning_face_with_smiling_eyes:!

Thanks for the answer, but the destructuring is correct, because all other information that I use are correct (like the amount), except the deal_product_id.

Using your snippet I recieved the same result:

The response variable:

The response.response (deal object):

The response.response (deal_products object):
image

The has_products is true, the deal_product_id is null and the deal_products array is empty :frowning_face:.

@Matozinho,
Thanks for the clarification,
Let me check with the product team and get back to you at the earliest

Thanks

1 Like

Thanks @Santhosh!

I’ll be waiting.

1 Like

@Matozinho ,

It seems there is an issue with the account, I request you to create an L2 ticket by sending an email to support@freshsales.io

Thanks

1 Like

Thanks @Santhosh, I already sent the email :grinning_face_with_smiling_eyes:.

Hi @Matozinho

Can you try using the below url,

https://domain.myfreshworks.com/crm/sales/deals/id?include=products

We are working on the Products module API but for now do let me know if this works for you.

Thanks

3 Likes

Hi @Pulkit_Chowdry, it worked!

the products come in a array inside the deal object.

image

Thanks :grinning_face_with_smiling_eyes:!

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.