Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Create a Company other than the Contact

$
0
0

Replies: 0

My Caldera Forms form collects data related to a person, but also related to his/her company.

I need to create both the contact and the company on Mautic using this processor.

I’m able to implement the feature but I need guidance on how to proceed (which is the development flow? Do I need to check the code in any way before committing? Any info that I need to know before proceeding?).

I think this can be done with a really simple code.

In Mautic all fields related to companies are like “company*” (ex.: companyaddress1, companyemail, etc.).

This means that we can check if the current mapped field starts with “company”: if it starts with “company” we can add the field to a second array “companyData”.

So, the steps to create both companies and contacts are those:

1. Cycle over each field;
2. If starts with “company”, add to $companyData array; if it doesn’t start with “company”, add to $contactData array;
3. If not empty $contactData, prepare and submit the request to Mautic’s endpoint contacts;
4. If not empty $companyData, prepare and submit the request to Mautic’s endpoint companies.

What do you think about this?


Viewing all articles
Browse latest Browse all 59525

Trending Articles