Project Template Tasks - Extra Fields

Hi there guys

Firstly, Hi and thanks for such a great product.

I am using the Project Template Module.
Everything is working fine.

2 Questions

  1. I created an extra field for Project Template Tasks, how can I map that extra field to Project Tasks so that the value gets populated across when creating a new Project from the template?

  2. I would like to add Project Tasks Activities to the Template function and have the individual activities come across from the template as well. Is this possible?

Thanks in advance

Walter

You cant do either of those things without custom coding I’m afraid.

For question 1 this is relatively easy, you would just add the extra field to the while loop in modules/AM_ProjectTemplates/controller.php starting after line 78.

Question 2 is not as simple and you would really need to know what your doing with php and Suite’s relationships framework to be able to achieve it.

Thanks for Q1, I can do that myself not a problem.

Without the functionality of Q2, Project Templates are not really that useful.
What would the effort be to achieve this?

I would gladly contribute financially for this functionality, if not, some sample code, or some guidance to achieve this would be greatly appreciated.

Regards

Walter

Hi there

I have made the changes to Q1, but it is not working.
Do I need to restart the apache server? I wouldn’t have thought so?

Thanks

No need to restart the apache but turn developer mode on in the admin settings.

Post the line of code you have added.

What sort of activities are we talking about? Calls, tasks etc… ?

Let me think this through you have added a custom field via studio to Task templates correct?

You have added another custom field via studio with the same name to Project templates correct?

I have enabled developer mode

Here is the simple line of code added.


$project_task->extra2_c = $row['extra2_c'];

correct on both assumptions
created identical field names and properties on both modules through studio

Yes, thats right, think of them as Sub Tasks.
Call, task, doesnt really matter. Once the functionality is working I can simply add the required fields to the existing code mapping like for Q1

Sorry, used quick reply instead of reply, so my replies are not grouped correctly with your questions.

Its not working because the $get_tasks query above does not get the custom fields.

where is am_tasktemplates defined?

AM_TaskTemplates_sugar.php , I have added the custom field to this as well, with no luck either

No that would not work. Ill get back to you.

thanks alot

appreciated

W

Ok in modules/AM_ProjectTemplates/controller.php line 62 replace


SELECT * FROM am_tasktemplates
                        WHERE id
                        IN (
                            SELECT am_tasktemplates_am_projecttemplatesam_tasktemplates_idb
                            FROM am_tasktemplates_am_projecttemplates_c
                            WHERE am_tasktemplates_am_projecttemplatesam_projecttemplates_ida = '".$template_id."'
                            AND deleted =0
                        )
                        AND deleted =0
                        ORDER BY am_tasktemplates.order_number ASC

with this



SELECT *
FROM am_tasktemplates
JOIN am_tasktemplates_cstm ON am_tasktemplates.id = am_tasktemplates_cstm.id_c
WHERE id
IN (

SELECT am_tasktemplates_am_projecttemplatesam_tasktemplates_idb
FROM am_tasktemplates_am_projecttemplates_c
WHERE am_tasktemplates_am_projecttemplatesam_projecttemplates_ida = '".$template_id."'
AND deleted =0
)
AND deleted =0
ORDER BY am_tasktemplates.order_number ASC 

This should now work.

Thanks, I will give it a shot and report back

Your a legend mate!!
That worked a treat.

Now about adding those activities :slight_smile:

There is already a 1 to many relationship to activities from Tasks, so its not extremely difficult?

Not something a sturdy scotsman fears am I right :cheer: B)

W

Unfortunately I don’t have time to do all of this for you. You could try doing it yourself using the example already in the controller.

You would need to add your relationships to both task templates and project templates in studio then in the controller within the while loop get the relationships you want for each task template and store them in an array.

After line 115 $project_task->save(); you will see relationships being added, you will have to add your relationships the same way.

Its not easy :wink: