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.