How to View Related Emails from Tasks Module in SuiteCRM

Hi everyone,

I’m having an issue with viewing related emails in the Tasks module of SuiteCRM. Here’s my situation:

  • I can successfully relate emails to tasks
  • However, when I open a task, I cannot see the related emails
  • I’ve checked the subpanels in the task view but can’t locate where the related emails should appear

Questions:

  • Where exactly should I be able to see related emails when viewing a task?
  • Is there a specific subpanel or tab I should be looking for?
  • Are there any specific settings I need to enable to view related emails in tasks?

System Information:

SuiteCRM Version: 8.7.1
Browser: Firefox 133.0.1

Any help or guidance would be greatly appreciated.

Thanks in advance!

Tasks by default do not have an Activities relationship.

You would have to create one in Studio between tasks and Activities.

Then for each email, you would have to select the “Parent” as task and the parent ID as the specifc task for each eamil you want related to a task.

@pstevens, After following your suggestion, my system became unusable as I was unable to login. In the thread https://community.suitecrm.com/t/suitecrm-8-7-1-system-inaccessible-after-creating-task-activity-relationship/98187?u=ramezquitao , I’ve documented the steps I took to recover the system. I’m not sure if they were the correct steps, but they worked.

After resolving the login issue, I checked the task relationships and discovered there is a many-to-many Tasks-Emails relationship. However, I still cannot find a way to view this relationship in the Tasks module.

Any ideas?

No it a one to many notes to activities and it will create all the activities relationships at once including emails

@pstevens, are you suggesting a one-to-many relationship where Tasks is the primary module and Activities is the secondary module?

I already tried that, but it rendered my system unusable. I can attempt it again, but what should I check if my system becomes unusable again? Last time, when trying to access the system, I received an “Error occurred while fetching metadata” message, and the screen remained blank after the error message.

Thanks for your help

Did you do a repair and rebuild after? Maybe because activities includes tasks its causing a problem, but you can theoretically have tasks related to tasks. I can’t see why not.

@pstevens, it was not possible to repair and rebuild, as the whole interface went down. There were no menus or any other elements visible.

I’ll try it on one of my dev jnstalls and see what happens.

Well I was able to create the Activities to tasks. Didn’t crash out, but its definately not working:

@ramezquitao did you try some other simple customization from Studio? If that also crashes your system, I would suspect problems with file ownerships/permissions. These are very common on new installations.

@pgr it’s kind of wierd, the relationships all look good, I don’t get any errors but the sub panels are all crashed out. I’ll have to investigate further when I get a minute, but I’m thinking this should work to create the activities relationship to another activity, the name is just _1 like in my screen shot. There are other examples of a module relating to itself, like the parent-child relationship between parent accounts. Maybe there is something in the PHP error log that will give me a clue.

I was surprised to hear about adding Activities subpanels from studio.

I wouldn’t say that would work, those panels are aggregators of several modules, they’re complex.

So I was only starting to think that’s possible after hearing you say it worked.

But if it’s not working… Then probably it’s best to use simple relationships to the individual modules (like emails)

@pgr I’ve added activities to a bunch of different modules over the years and it has never been a problem, mostly custom modules. I think I’ve added it to projects too (can’t remember if its default or not) and never had an issue. I guess because the relationships are relating an “activity” to “activities” it’s causing a problem. I can’t recall if I’ve ever tried it with a call/meeting/task before. I can see why you might want activities related to a task. You could associate calls/tasks/ emails with the main task. Maybe a “project” would be a better way to do this, but a task could be like a mini project with all the history associated with that task. Kind of puzzled it doesn’t work. I’ll have to dive into that deeper when I get a chance. I can see the business case for it.

1 Like

Taa…daaaa…

The issue seems to be with the task-task relationship. I turned it off and the rest work.

image

This is what got created. Other than it’s there twice (which I tried to fix), I don’t see anything wrong, ideas?

<?php
// created: 2025-01-10 02:18:32
$dictionary["Task"]["fields"]["tasks_activities_1_tasks"] = array (
  'name' => 'tasks_activities_1_tasks',
  'type' => 'link',
  'relationship' => 'tasks_activities_1_tasks',
  'source' => 'non-db',
  'module' => 'Tasks',
  'bean_name' => 'Task',
  'vname' => 'LBL_TASKS_ACTIVITIES_1_TASKS_FROM_TASKS_TITLE',
);
/**
$dictionary["Task"]["fields"]["tasks_activities_1_tasks"] = array (
  'name' => 'tasks_activities_1_tasks',
  'type' => 'link',
  'relationship' => 'tasks_activities_1_tasks',
  'source' => 'non-db',
  'module' => 'Tasks',
  'bean_name' => 'Task',
  'vname' => 'LBL_TASKS_ACTIVITIES_1_TASKS_FROM_TASKS_TITLE',
);**/
1 Like

That’s good work! Could you please create PR on the GitHub and mention your findings?? :raised_hands: :partying_face:

I’m not really sure what the issue is yet, other than “tasks_activities_1_tasks” seems to be a problem. The rest work.

This is the error that’s thrown when this relationship is active:

[10-Jan-2025 21:01:22 UTC] PHP Fatal error:  Uncaught TypeError: Cannot access offset of type string on string in 
/home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/data/Relationships/One2MRelationship.php:110
Stack trace:
#0 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/data/Relationships/One2MBeanRelationship.php(59): One2MRelationship->__construct(Array)
#1 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/data/Relationships/RelationshipFactory.php(126): One2MBeanRelationship->__construct(Array)
#2 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/data/Link2.php(127): SugarRelationshipFactory->getRelationship('tasks_activitie...')
#3 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/data/SugarBean.php(1994): Link2->__construct('tasks_activitie...', Object(Task))
#4 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/data/SugarBean.php(1077): SugarBean->load_relationship('tasks_activitie...')
#5 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/data/SugarBean.php(885): SugarBean::build_sub_queries_for_union(Array, Object(aSubPanel), Object(Task), 'date_modified')
#6 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/include/ListView/ListView.php(1154): SugarBean::get_union_related_list(Object(Task), 'date_modified', 'desc', '', 0, -1, 10, '', Object(aSubPanel))
#7 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/include/ListView/ListViewSubPanel.php(143): ListView->processUnionBeans(Object(Task), Object(aSubPanel), 'history_CELL', false)
#8 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/include/SubPanel/SubPanel.php(221): ListViewSubPanel->process_dynamic_listview('Tasks', Object(Task), Object(aSubPanel), false)
#9 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/include/SubPanel/SubPanelTiles.php(359): SubPanel->ProcessSubPanelListView('include/SubPane...', Array)
#10 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/include/MVC/View/SugarView.php(1182): SubPanelTiles->display()
#11 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/include/MVC/View/SugarView.php(239): SugarView->_displaySubPanels()
#12 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/include/MVC/Controller/SugarController.php(432): SugarView->process()
#13 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/include/MVC/Controller/SugarController.php(363): SugarController->processView()
#14 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/include/MVC/SugarApplication.php(101): SugarController->execute()
#15 /home/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/index.php(52): SugarApplication->execute()
#16 {main}

@pstevens One off topic question: Where do you see this error messages? Is there something I have to activate so they get created?

Thanks

They are in my server’s php error logs not in the SuiteCRM Log. The Activities and Tasks subpanels work perfectly except for “Tasks” which I turned off. So if you leave all the others active and just turn of tasks it should work. However I did have to do an R&R.

@pstevens I don’t know what happens with my installation, but it does not behave as yours. When I do as you described, my screen shows an “Error occurred while fetching metadata” and shows nothing. I tried renaming the task_activities_1* files as you did in your example, but this did not recover my system.

Something I’m getting, but I’m not sure what I did to make them appear, are the following error messages in the /var/www/html/logs/prod/prod.log file :

2025-01-10 23:36:16] request.CRITICAL: Uncaught PHP Exception Error: "Failed opening required '/var/www/html/cache/prod/ContainerVnQHcyy/getApiPlatform_Listener_ExceptionService.php' (include_path='/var/www/html/public/legacy/include/..:.:/usr/share/php')" at App_KernelProdContainer.php line 552 {"exception":"[object] (Error(code: 0): Failed opening required '/var/www/html/cache/prod/ContainerVnQHcyy/getApiPlatform_Listener_ExceptionService.php' (include_path='/var/www/html/public/legacy/include/..:.:/usr/share/php') at /var/www/html/cache/prod/ContainerVnQHcyy/App_KernelProdContainer.php:552)"} []

[2025-01-10 23:36:16] php.CRITICAL: Uncaught Error: Failed opening required '/var/www/html/cache/prod/ContainerVnQHcyy/getApiPlatform_Listener_ExceptionService.php' (include_path='/var/www/html/public/legacy/include/..:.:/usr/share/php') {"exception":"[object] (Error(code: 0): Failed opening required '/var/www/html/cache/prod/ContainerVnQHcyy/getApiPlatform_Listener_ExceptionService.php' (include_path='/var/www/html/public/legacy/include/..:.:/usr/share/php') at /var/www/html/cache/prod/ContainerVnQHcyy/App_KernelProdContainer.php:552)"} []

but when I check the file is there, and the permissions and ownership are correct.

I also see a lot of messages like unable to find relationships emails_email_templates or projects_contacts_resources (and some others) in /var/www/html/public/legacy/suitecrm.log , but when you look at the database the relationships are there.

In the log of apache, or in syslog (php_error.log) there is nothing.

Maybe as trying to understand suiteCRM, I did something really wrong and broke the installation? Is there a way to correct it? Or it will be the best to reinstall again and try to migrate the information? I guess the database can not be migrated, because if it is corrupt the new installation will have the have the same problems, so I may need to export and re-import the info.

One test I performed, as suggested by @pgr, was to create a many to many relationship between tasks and emails, and that seem to be working, but I’m not sure if it is worth the risk to try to keep running this installation. From your experience, what do you suggest?

One last thing, checking your tasks image, you have a history panel. This one does not appear in my installation. Is there something I need to do? this is exactly what I want to be able to follow up the task.

Just to complete the information:

OS: Debian 12 in an LXC container
PHP: 8.2.26
Apache: 2.4.62
Mariadb: 10.11.6

Thanks again to @pstevens and @pgr for trying to help me solve this problem.

The history panel and activity panel are created automatically when the activity relationship is set. If you only need emails and you have emails working. Maybe just stick with that.