# Has anyone imported Custom Objects successfully?

**URL:** <https://forum.mautic.org/t/has-anyone-imported-custom-objects-successfully/24934>\
**Category:** Product Support\
**Created:** [August 2, 2022, 8:56am UTC](https://forum.mautic.org/t/has-anyone-imported-custom-objects-successfully/24934 "2022-08-02T08:56:52Z")\
**Posts on this page:** 9\
**Page:** 1

<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:** [August 2, 2022, 8:56am UTC](https://forum.mautic.org/t/has-anyone-imported-custom-objects-successfully/24934/1 "2022-08-02T08:56:52Z")

</div>

**Your software**  
My Mautic version is: 4.4.0 - 4.4.1  
My PHP version is: 7.4 - 8.0  
My Database type and version is: 10.6.8-MariaDB-1:10.6.8+maria~bionic

**Your problem**  
My problem is:

I’m trying to import a custom object and link with a contact. I get a 500 error every time.

My object looks like this:

The object has 2 fields:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/1/16c79eb43e8e3c092a32b0b13a983c240a77a178.png)

Looks like this:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/a/a41b51649f4ca540ed33700a477a58a8ac2aed0f.png)

This is my import file, where the id of the contact is an existing contact:

```auto
customItemName,lang,rec,linkedContactIds
Birthday Party2,en,3,16523

```

These errors are showing in the log:  
[2022-08-02 08:42:54] mautic.WARNING: File /var/www/html/mautic/app/…/var/tmp/imports/20220802084213.csv was removed. {“hostname”:“mauticjoey”,“pid”:210376}  
[2022-08-02 08:42:54] mautic.WARNING: Import for file /var/www/html/mautic/app/…/var/tmp/imports/20220802084213.csv was aborted because the form is empty. {“hostname”:“mauticjoey”,“pid”:210376}  
[2022-08-02 08:43:05] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: “Typed property Mautic\LeadBundle\Event\ImportValidateEvent::$list must not be accessed before initialization” at /var/www/html/mautic/app/bundles/LeadBundle/Event/ImportValidateEvent.php line 94 {“exception”:“[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Typed property Mautic\LeadBundle\Event\ImportValidateEvent::$list must not be accessed before initialization at /var/www/html/mautic/app/bundles/LeadBundle/Event/ImportValidateEvent.php:94)”} {“hostname”:“mauticjoey”,“pid”:210377}  
[2022-08-02 08:43:05] mautic.WARNING: PHP Warning - Trying to access array offset on value of type bool - in file /var/www/html/mautic/app/bundles/CoreBundle/Controller/ExceptionController.php - at line 111 {“hostname”:“mauticjoey”,“pid”:210377}

Steps I have tried to fix the problem:  
Changed the import values all possible ways. Upgraded to php 8.0

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [August 2, 2022, 9:38am UTC](https://forum.mautic.org/t/has-anyone-imported-custom-objects-successfully/24934/2 "2022-08-02T09:38:16Z")

</div>

Where did you get instructions to import it this way?

Knowing how CO is structured in database I am not sure you even can import as simply as the above example.

---

<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:** [August 2, 2022, 9:40am UTC](https://forum.mautic.org/t/has-anyone-imported-custom-objects-successfully/24934/3 "2022-08-02T09:40:52Z")

</div>

@mzagmajster , Thank you for getting back to me.  
Here:

> **[Import · acquia/mc-cs-plugin-custom-objects Wiki](https://github.com/acquia/mc-cs-plugin-custom-objects/wiki/Import)**
>
> Mautic plugin adding Custom Objects feature. Contribute to acquia/mc-cs-plugin-custom-objects development by creating an account on GitHub.

Maybe I misunderstood something?

---

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [August 2, 2022, 9:59am UTC](https://forum.mautic.org/t/has-anyone-imported-custom-objects-successfully/24934/4 "2022-08-02T09:59:25Z")

</div>

Aha, at first glance - assuming the import file is ok, this looks like a bug, further testing is required though to confirm or deny this claim.

I will check later today on my custom objects, thanks for shinning a light on it.

---

<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:** [August 2, 2022, 10:18am UTC](https://forum.mautic.org/t/has-anyone-imported-custom-objects-successfully/24934/5 "2022-08-02T10:18:39Z")

</div>

Thx for checking, let me know.

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [August 9, 2022, 2:57pm UTC](https://forum.mautic.org/t/has-anyone-imported-custom-objects-successfully/24934/6 "2022-08-09T14:57:34Z")

</div>

Could you please raise it as an issue here:

> **[Issues · acquia/mc-cs-plugin-custom-objects](https://github.com/acquia/mc-cs-plugin-custom-objects/issues)**
>
> Mautic plugin adding Custom Objects feature. Contribute to acquia/mc-cs-plugin-custom-objects development by creating an account on GitHub.

I think we might possibly have a bug fix for this in test at Acquia waiting to come to the community but I am not able to access the log files to confirm if it is the same issue you are facing.

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [August 10, 2022, 8:21am UTC](https://forum.mautic.org/t/has-anyone-imported-custom-objects-successfully/24934/7 "2022-08-10T08:21:56Z")

</div>

Hey @joeyk @mzagmajster please review and test

> <https://github.com/mautic/mautic/pull/11388>
>
> \<!-- ## Which branch should I use for my PR?
> 
> Assuming that:
> 
> a = current ma…jor release
> b = current minor release
> c = future major release
> 
> \* a.x for any features and enhancements (e.g. 5.x)
> \* a.b for any bug fixes (e.g. 4.4, 5.1)
> \* c.x for any features, enhancements or bug fixes with backward compatibility breaking changes (e.g. 5.x) --\>
> 
> | Q | A
> | -------------------------------------- | ---
> | Bug fix? (use the a.b branch) | ✅ 
> | New feature/enhancement? (use the a.x branch) | ❌ 
> | Deprecations? | ❌ 
> | BC breaks? (use the c.x branch) | ❌ 
> | Automated tests included? | ❌  
> | Related user documentation PR URL | mautic/mautic-documentation#... 
> | Related developer documentation PR URL | mautic/developer-documentation#... 
> | Issue(s) addressed | Fixes Custom Objects Imports 
> 
> \<!--
> Additionally (see https://contribute.mautic.org/contributing-to-mautic/developer/code/pull-requests#work-on-your-pull-request):
> - Always add tests and ensure they pass.
> - Bug fixes must be submitted against the lowest maintained branch where they apply
> (lowest branches are regularly merged to upper ones so they get the fixes too.)
> - Features and deprecations must be submitted against the "4.x" branch.
> \--\>
> 
> \#### Description:
> 
> \<!--
> Please write a short README for your feature/bugfix. This will help people understand your PR and what it aims to do. If you are fixing a bug and if there is no linked issue already, please provide steps to reproduce the issue here.
> \--\>
> 
> Since PHP 7.4 introduces type-hinting for properties, it is particularly important to provide valid values for all properties, so that all properties have values that match their declared types.
> 
> A property that has never been assigned doesn't have a null value, but it is on an uninitialized (undefined) state, which will never match any declared type (undefined !== null).
> 
> \#### Steps to test this PR:
> 
> \<!--
> This part is really important. If you want your PR to be merged, take the time to write very clear, annotated and step by step test instructions. Do not assume any previous knowledge - testers may not be developers.
> \--\>
> 1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs \[here\](https://contribute.mautic.org/contributing-to-mautic/tester))
> 2. Create custom object with some fields
> 3. Now, try to import a CSV with relevant fields for custom objects
> 4. Observe the "Property must not be accessed before initialization error" message in the logs before the PR is applied
> 5. After PR, you should be able to import CSV for custom objects 
> 
> \<!--
> If you have any deprecations, list them here along with the new alternative.
> If you have any backwards compatibility breaks, list them here.
> \--\>
> 
> 
> \<a href="https://gitpod.io/#https://github.com/mautic/mautic/pull/11388"\>\<img src="https://gitpod.io/button/open-in-gitpod.svg"/\>\</a\>

which should resolve this bug!

---

<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:** [August 10, 2022, 10:44am UTC](https://forum.mautic.org/t/has-anyone-imported-custom-objects-successfully/24934/8 "2022-08-10T10:44:01Z")

</div>

Yes, that solves the bug 😃  
THANK YOU!

---

<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:** [August 11, 2022, 10:44pm UTC](https://forum.mautic.org/t/has-anyone-imported-custom-objects-successfully/24934/9 "2022-08-11T22:44:10Z")

</div>

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