Add Campaign/Target List Support For A Custom Module

So Iā€™ve got a situation where a client has ā€œmedia contactsā€ that are a custom module and separate from leads and contacts. The idea is these are newspaper/blog contacts, etc that will be notified of new products, etc.

Theyā€™d like to use campaigns to send newsletters. However, when I create campaigns to a target list comprised of contacts from a custom module it says in wizard ā€œYou cannot send a marketing email until your subscription list has at least one entry. You can populate your list after finishing.ā€

Iā€™ve created a many to many relationship between ā€œmedia contactsā€ and ā€œtarget listsā€ so adding them to a target list is no problem.

It just keeps telling me there are no targets on the list.

Iā€™m guessing I have to add some code to add ā€œmedia contactsā€ to ā€œtargetsā€

Anyone ever done this and can point me in the right direction. Iā€™ve Googled but not a lot of relevant stuff.

I do see this in the error log (event though Iā€™ve created the relationship)

Missing relationship definition free_frelancers_prospectlists_1. skipping free_frelancers_prospectlists_1 subpanel

(note: in my test environment Iā€™m using ā€œfreelancersā€ as my custom module instead of ā€œmedia contactsā€ to test the functionality)

Have alook here:
http://web.archive.org/web/20140825230331/http://sugaruk.co.uk/blog/how-add-campaigntarget-list-support-custom-person-module-sugarcrm

If you manage to get it working please post entire solution.

1 Like

Thatā€™s perfect! Looks pretty straight forward. Iā€™ll give that a try and post an update on how it went.

No luck, the procedure outlined seems to duplicate functionality thatā€™s already there by adding Target List - Custom Module relationship. That already worked.

The problem was when you add the target list to the Campaign, it says there are no Targets in the list. This same problem exists with the solution noted.

Even when you add a custom contact to a target list, even though they are on the list, it counts 0 targets on the list??? Thatā€™s the part thatā€™s driving me crazy.

I guess Iā€™m stuck, everything seems to work like it supposed to for a custom module in terms of target lists and campaigns, except that it doesnā€™t find any targets on the list (even though there are contacts from a custom module). Is this a bug, or something that required custom coding?

screenshot

Thought Iā€™d give this one a bump. I have the occasion to do this every once in a while and have never been able to find a solution to make a custom module (persons) be able to work with Campaigns. I can make a relationship between target lists and the custom module, I can add custom module people to th target list. I can add the target list to the campaign. However, the campaign reports no targets in list???

Am I missing a relationship somewhere, or do I have to somewhere designate my custom module of people as targets?

This is just a hunch, but maybe try having a look at thisā€¦

ā€“> https://github.com/salesagility/SuiteCRM/search?q=EmailInterface&unscoped_q=EmailInterface

Thanks @pgr !!! Iā€™ll try that out, hope itā€™s as simple as adding the require onceā€¦ email interface to the custom module. Iā€™ll do some testing and report back.

Ok tried adding the require once to to the custom module, didnā€™t crash it , but didnā€™t work either. The other thing I noticed is the custom module for ā€œpeopleā€ doesnā€™t seem to support the concept of ā€œmanage subscriptionsā€ that contacts, leads and targets do. Hmm, everything else seems to integrate seamlessly except for the Campaign Target lists.

Did you add the implements EmailIInterface to your class declaration?

You would also need to define any functions that the interface requires, but inspecting the interface I see it is empty, so nothing should be required.

Do you have any Emailinterface messages in your logs?

Hey @pgr, yes I added the implementsā€¦ and looked for anything else in the leads/contacts/targets that seemed relevant, I tried adding the $campaigns too, but still nothing. I just canā€™t figure out where or how the campaign module is calculating zero targets either. I tried to hunt that down to see if it would give me a clue.

Hi pstevens
I have the same problemā€¦ were you able to solve it?

Thanks

I was never able to solve this one. Iā€™ve been trying to solve this for like 4 years. Iā€™ve tried a whole bunch of stuff along with the suggestions above but just canā€™t seem to get the campaigns module to work with a custom module of contacts.

Perhaps the code that manages the ā€˜ProspectListsā€™ should be changed heavily. I donā€™t know how much is worth :sweat_smile:

@pstevens what is the status on your attempts?

Can you get the Custom records added to the Target Lists at all? But then they donā€™t send when the Campaign runs?

Thanks @pgr for chiming inā€¦ I can get the custom module contacts to be added to a target list, no problem. I can add that target list to the campaign, no problem. The problem is that the ā€œcampaignā€ doesnā€™t see the targets. It counts ā€œ0ā€ targets in list and then when you try to send you get an error that there are no targets found in target lists.


There are in fact contacts on the target list. I guess somehow it doesnā€™t recognize them as ā€œtargetsā€.

** by ā€œContactsā€ I mean my custom module ā€œFreelancersā€ contacts. I have a relationship between Target Lists and Freelancers. Which allows me to add them to the target list.

I think this is where itā€™s counting:

Do your target entries get registered in prospect_lists_prospects relationship table, or is it in a different table, due to being a custom module? Have a look in your database.

Cool, Iā€™ll check it out. Iā€™ve been stumped on this one for a while. Thatā€™s a great clue!

OK wā€™ere on to something! My ā€œFrelancersā€ are not in the prospect_lists_ prospects, but in in prospectlists_freelancers.

So, weā€™re getting closer, either we have to count prospect_lists_CUSTOM_MODULE_NAME in the code, or somehow have to add Freelancers to this table.

Cool. Remember that here weā€™re only battling the warning message when the count fails; but if we solve this one, we will probably hit a bump further ahead - getting the custom ā€œprospectsā€ added to the queue.

So I think we should look for a solution to make things work everywhere - something like tweaking the freelancers relationship to use the prospect_lists_prospects table too.