Survey Unknown Contact

Hi,
I set up a test survey, sent as campaign.

Unfortunately, I’m noticing that the response is only tracked if it’s a contact. If it’s a lead, “Unknown Contact” appears.
If it is an email from the Accounts module, the link in the email is not created either.

Can anyone tell me more about this and if it can be solved?

Thanks a lot!

Hey,

I’ve had a quick look into how Surveys works and, as far as I can tell, it seems to just be the extent of what’s doable in Surveys at the moment :confused:


Regarding the "Unknown Contact", it seems as though this is due to the file :

modules/Surveys/Entry/SurveySubmit.php    Starting at line ~40

When submitting a Survey, it grabs information from the Contact to populate the Survey Response record
For a Lead, as its looking for a Contact ID (and cannot find it), it retains the default value “Unknown Contact” for the name.


Regarding Sending to Accounts,

Looking at the file:

modules/EmailTemplates/EmailTemplateParser.php    Starting at line ~234
It, again, looks like it just grabs “Contact” information
So, it cannot generate the Account link, as it is not currently passing along/looking for an Account ID


If I were to guess, I’d say it successfully builds the URL for Leads when sending, due to Campaigns treating Contacts/Leads/Targets similarly
I’d imagine that similar values are being sent when generating the Email


Hopefully the above sheds some light on how/why it behaves as it does
Though, unfortunately, it looks like the functionality would need to be expanded on to fully include Accounts/Leads, so I’d look into those two files if you felt comfortable with customizing the functionality

Although, I don’t use the Surveys module particularly often, so if anyone has knowledge otherwise, I’m happy to hear it!

This does sound like it would be good to raise on the SuiteCRM Project’s Github as a Suggestion, if it is indeed not currently possible

1 Like

Thanks a lot,
now the behavior is clear.

Absolutely correct.

I will try to expand the function. At least for leads (this shouldn’t be complicated).

As I suspected, the lead problem is easily solved with a few lines of code (to insert where you reported):

$lead = BeanFactory::getBean('Leads', $contactId);
		if (!empty($lead->id)) {
			$leadlasttname = $lead->last_name;
			$leadfirstname = $lead->first_name;
            $contactName = $leadfirstname." ".$leadlasttname;
            $accountId = "";
        }

Now, I’ll try a solution for the accounts problem…

Please note that this solution is not complete because the lead module relationship is missing in the response detail.

1 Like