# Code to update contact field via campaign

**URL:** <https://forum.mautic.org/t/code-to-update-contact-field-via-campaign/20741>\
**Category:** Product Support\
**Created:** [September 4, 2021, 5:30pm UTC](https://forum.mautic.org/t/code-to-update-contact-field-via-campaign/20741 "2021-09-04T17:30:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![precords](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/precords/32/1504_2.png) [@precords](https://forum.mautic.org/u/precords)\
**Post date:** [September 4, 2021, 5:30pm UTC](https://forum.mautic.org/t/code-to-update-contact-field-via-campaign/20741/1 "2021-09-04T17:30:33Z")

</div>

My Mautic version is: 2.8.2  
My PHP version is: 5.6.37  
My Database type and version is: 10.1.48-MariaDB

**Your problem**  
What code do I use in a campaign to update contact copying the contents of the companyphone field to mobile phone field?? There is no instructions anywhere on how to put a variable to update the conctact!!  
Thank you!

---

<div class="post-metadata">

**Author:** ![EJL](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ejl/32/12155_2.png) [@EJL](https://forum.mautic.org/u/EJL)\
**Post date:** [September 4, 2021, 7:54pm UTC](https://forum.mautic.org/t/code-to-update-contact-field-via-campaign/20741/2 "2021-09-04T19:54:21Z")

</div>

To my knowledge there is no way to do this in Mautic. I’ve tried several variations and haven’t found a solution. I copied the data over to a column in CSV file and re-uploaded to update the info.

---

<div class="post-metadata">

**Author:** ![modifiedcontent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/modifiedcontent/32/511_2.png) [@modifiedcontent](https://forum.mautic.org/u/modifiedcontent)\
**Post date:** [September 5, 2021, 6:44pm UTC](https://forum.mautic.org/t/code-to-update-contact-field-via-campaign/20741/3 "2021-09-05T18:44:59Z")

</div>

It is a bit unclear what you are asking here.

1. Do you want a form associated with a campaign that allows your customers/prospects to enter a phone number that then will be stored in the mobile phone field in your Mautic database?

2. Or do you want to copy all the company phone numbers for a campaign list to the mobile phone field?

Number 1 you could do with Forms (in dashboard menu under Components).

For issue 2, just exporting the campaign list, copying the companyphone row to the mobile phone row in Excel/CSV and importing back would probably be the easiest. Or exporting the companyphone row (with the ID row) and copying to ‘mobile phone’ field in import, same thing.

Btw, Mautic version 2.8.2 is getting a bit old. Mautic 4 was recently released. Keeping updated will prevent issues in the long run.
