# Campaigne webhook with company custom field is empty

**URL:** <https://forum.mautic.org/t/campaigne-webhook-with-company-custom-field-is-empty/28325>\
**Category:** Product Support\
**Tags:** mautic-4\
**Created:** [June 15, 2023, 10:16am UTC](https://forum.mautic.org/t/campaigne-webhook-with-company-custom-field-is-empty/28325 "2023-06-15T10:16:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbuecker](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dbuecker](https://forum.mautic.org/u/dbuecker)\
**Post date:** [June 15, 2023, 10:16am UTC](https://forum.mautic.org/t/campaigne-webhook-with-company-custom-field-is-empty/28325/1 "2023-06-15T10:16:28Z")

</div>

My Mautic version is: v 4.4.9  
My PHP version is: 8.0.26  
My Database type and version is: mariaDB 5.7.35-38

My problem is:  
Hey, im new to mautic and i have a problem with a campaign webhook.

I created a custom field for companys( IDF-number and U-ID).

 ![company_fields](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/e/e54a8dbb789b91801f6e27b1cf4a7b4eff548ebb.png)

In the campaign i send a POST webhook with contact data and company data to an external API. In this test case to webhook.site.

 ![webhook](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/5/5319d119b840265d1e06d7d60cfbde6841e8f8c6.png)

The contact is associated with a primary company ( from which i would like to send the custom fields to the API).

However all contact data is send successfully expect the company custom fields. The response is empty.  
 ![result](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/6/6acafe1ede89a46d868c0b82fa92a0ba57f692fa.png)

Do i miss something here? I use `{contactfield=uid}` (uid is the alias for custom field U-ID) like the documentation recomends.

Thanks in advance!

These errors are showing in the log:  
mautic.NOTICE: PHP Notice - Undefined index: uid - in file /html/mautic-new/docroot/app/bundles/LeadBundle/Helper/TokenHelper.php - at line 87

---

<div class="post-metadata">

**Author:** ![dbuecker](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dbuecker](https://forum.mautic.org/u/dbuecker)\
**Post date:** [June 21, 2023, 7:31am UTC](https://forum.mautic.org/t/campaigne-webhook-with-company-custom-field-is-empty/28325/2 "2023-06-21T07:31:00Z")

</div>

I would appreciate any input or info here, any bit of information could be helpfull.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![tancredi](https://avatars.discourse-cdn.com/v4/letter/t/b3f665/32.png) [@tancredi](https://forum.mautic.org/u/tancredi)\
**Post date:** [June 21, 2023, 9:25am UTC](https://forum.mautic.org/t/campaigne-webhook-with-company-custom-field-is-empty/28325/3 "2023-06-21T09:25:00Z")

</div>

The issue you are experiencing with the empty response and the PHP Notice in Mautic can be addressed as follows:

Empty Response Issue:

To troubleshoot why the company custom fields are not being sent successfully to the external API, you can perform the following steps:

- Verify API Endpoint: Ensure that the API endpoint you are sending the webhook to is correctly configured to receive and process the company custom fields. Check the API documentation or contact the API provider for any specific requirements or limitations.

- Check Webhook Configuration: Double-check the configuration of the webhook in Mautic. Make sure you are including the company custom fields in the payload and that they are correctly mapped to the corresponding fields in the API.

- Review Field Mapping: Verify that the company custom fields in Mautic are properly mapped to the corresponding fields in the external API. Check for any inconsistencies or errors in the mapping configuration.

- Test with Different Data: Try sending the webhook with different company data, including custom fields, to see if the issue persists. This can help identify if the problem lies with specific data or if it is a broader configuration issue.

- Debug the API: If possible, review the logs or error messages on the API side to see if any errors or issues are reported during the webhook request. This can provide valuable insights into why the response is empty.

PHP Notice in Mautic:

The PHP Notice you mentioned regarding the undefined index ‘uid’ in the TokenHelper.php file can be resolved by following these steps:

- Clear the Mautic cache to ensure that any outdated or conflicting data is removed. This can be done through the Mautic UI or by running the appropriate command, depending on your Mautic installation.

- Verify Code Customizations: If you have made any customizations to Mautic or its codebase, review the changes and ensure they are not causing conflicts or introducing errors. If necessary, revert the changes and check if the PHP Notice still occurs.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [June 21, 2023, 1:32pm UTC](https://forum.mautic.org/t/campaigne-webhook-with-company-custom-field-is-empty/28325/4 "2023-06-21T13:32:55Z")

</div>

This is a known issue:

> <https://github.com/mautic/mautic/issues/12468>
>
> \### Mautic Version
> 
> 4.4.x series
> 
> \### PHP version
> 
> 8.0
> 
> \### What browsers are yo…u seeing the problem on?
> 
> Not relevant
> 
> \### What happened?
> 
> Neither action triggers a webhook:
> \- contact linked to a company
> \- contact company set primary
> \- contact company unset primary
> \- contact unlinked from company
> 
> \### How can we reproduce this issue?
> 
> Step 1: create a webhook in system settings for "contact updated" and connect it with a receiver (for testing, this may be helpful: https://webhook.site/)
> Step 2: test your webhook , e.g. with editing a user field like first name
> Step 3: check your webhook triggered (there is a log assigned to the webhook)
> Step 4: check the received data
> 
> Step 5: now test with company links as in the bug description. Mautic will not trigger any webhook for those actions
> 
> \### Relevant log output
> 
> \`\`\`shell
> None.
> \`\`\`
> 
> 
> \### Code of Conduct
> 
> \- \[X\] I confirm that I have read and agree to follow this project's Code of Conduct

---

<div class="post-metadata">

**Author:** ![dbuecker](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dbuecker](https://forum.mautic.org/u/dbuecker)\
**Post date:** [June 21, 2023, 1:43pm UTC](https://forum.mautic.org/t/campaigne-webhook-with-company-custom-field-is-empty/28325/5 "2023-06-21T13:43:07Z")

</div>

Hey Joey,  
thanks for your answer.

Is this bug fixed in Mautic 5? I think i can wait the last ~9 days to its official alpha release 🙂

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [June 21, 2023, 1:45pm UTC](https://forum.mautic.org/t/campaigne-webhook-with-company-custom-field-is-empty/28325/6 "2023-06-21T13:45:51Z")

</div>

Hi, it’s still open. To be fixed  
It’s a good thing, that there is a bug report created, so the right eyes are on the issue.  
On the side note: plz don’t use the alpha in production 😃

---

<div class="post-metadata">

**Author:** ![entrepositive](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/entrepositive/32/9645_2.png) [@entrepositive](https://forum.mautic.org/u/entrepositive)\
**Post date:** [September 17, 2024, 1:51pm UTC](https://forum.mautic.org/t/campaigne-webhook-with-company-custom-field-is-empty/28325/7 "2024-09-17T13:51:05Z")

</div>

Can any Custom Field data related to the Company object actually be sent out from Mautic, either by email or webhook?

I can’t say I’ve ever successfully associated a custom field to company, filled with data, sent to a member of the company, and seen the data filled by token into an email.

Pulling company data by API is of course a different story. The custom field data comes through in the JSON.

But I’ve never seen a token render the company custom field value into an email. In the years I’ve used Mautic, I’ve just avoided this categorically.

Is this actually possible?

EDIT: Seems the answer is No. This cannot be done. It seems however that it’s finally possible in Mautic 5. [More info here.](https://forum.mautic.org/t/using-company-object-custom-field-in-form/6901)
