I am trying to add a Project Template to a workflow when an Opportunity is set to a specific stage.
I can get the project to create but as soon as I tell it to set the Project Template to an existing Project Template the system crashes on a save. Keep in mind though that the project is created even though it crashes but has no tasks. There apache error logs shows:
[Tue May 30 13:50:31.764298 2023] [php7:error] [pid 1399] [client 192.168.110.180:50678] PHP Fatal error: Uncaught Error: Call to a member function add() on null in /var/www/suitecrm-dev/SuiteCRM-7.12.7/branch/modules/Project/Project.php:543
Stack trace:
#0 /var/www/suitecrm-dev/SuiteCRM-7.12.7/branch/modules/AOW_Actions/actions/actionCreateRecord.php(406): Project->save(true)
#1 /var/www/suitecrm-dev/SuiteCRM-7.12.7/branch/modules/AOW_Actions/actions/actionCreateRecord.php(169): actionCreateRecord->set_record(Object(Project), Object(Opportunity), Array)
#2 /var/www/suitecrm-dev/SuiteCRM-7.12.7/branch/modules/AOW_WorkFlow/AOW_WorkFlow.php(965): actionCreateRecord->run_action(Object(Opportunity), Array, true)
#3 /var/www/suitecrm-dev/SuiteCRM-7.12.7/branch/modules/AOW_WorkFlow/AOW_WorkFlow.php(229): AOW_WorkFlow->run_actions(Object(Opportunity), true)
#4 /var/www/suitecrm-dev/SuiteCRM-7.12.7/branch/include/utils/LogicHook.php(260): AOW_WorkFlow->run_bean_flows(Object(Opportunity), âafter_saveâ, ââ)
#5 /var/www/suitecrm-dev/SuiteCRM-7.12.7/branch/include/utils/LogicHook.php(201): LogicHook->process_hooks(Array, 'af in /var/www/suitecrm-dev/SuiteCRM-7.12.7/branch/modules/Project/Project.php on line 543, referer: https://suitecrm7-dev.kwikom.com/index.php
I have found other messages that speak to this but I did not find any solutions.
This is what my Actions look like:
This is what the code looks like in /modules/Project/Project.php
//copy all resources from template to project
$template->load_relationship('am_projecttemplates_users_1');
$template_users = $template->get_linked_beans('am_projecttemplates_users_1', 'User');
$template->load_relationship('am_projecttemplates_contacts_1');
$template_contacts = $template->get_linked_beans('am_projecttemplates_contacts_1', 'Contact');
foreach ($template_users as $user) {
$focus->project_users_1->add($user->id);
}
foreach ($template_contacts as $contact) {
$focus->project_contacts_1->add($contact->id);
}
According to the error, $template_users results in a null value. The Project Manager is set to Administrator and all but one of the steps is set to Administrator except the last one is set to a user.
Here is the view of the Project Templates View page.
I am not sure how to fix this. Any ideas?
Tony