Copy Project task comments/work notes to parent project

matthew_magee1
Giga Guru

Hi all,

I found this article to copy task comments to the requested item: Copy Task Comments into Request Item History

What I have been asked to do is copy any work notes/comments from the project task to the parent project.

I've create a business rule, that does fire, but the information is NOT being transposed to the project. My ultimate goal is to get the work notes and comments from the task into the Activity area of the parent Project

gs.log('comment: ' + current.comments);

gs.log('wn: ' + current.work_notes);

var gr = new GlideRecord('pm_project');

gr.addQuery('sys_id', current.top_task.sys_id);

gr.query();

while (gr.next()) {

gr.setValue('comments',current.comment);**

gr.setValue('work_notes',current.work_notes);**

gr.update();

}

**again, I'd like these to appear in the Activity area of the parent project

Any help is greatly appreciated-

1 ACCEPTED SOLUTION

Here you go. Use this code in after business rule on project task table


When: after insert5 and update


Conditions Additional Comments Changes OR Work notes changes


Script:



var gr = new GlideRecord('pm_project');


                              if(gr.get(current.getValue('top_task'))){


                                                              if(current.comments.changes())


                                                              gr.comments=current.comments.getJournalEntry(1);


                                                              if(current.work_notes.changes())


                                                              gr.work_notes=current.work_notes.getJournalEntry(1);


                                                              gr.update();


                              }


View solution in original post

13 REPLIES 13

Hi,

This works and I am able to copy task comments to parent incident, but in the task the comments are displayed twice. Any guess why it could be showing two times with in the task? Parent incident shows one time. Appreciate your help!

Thanks

 

 

 

Hi,

This works and I am able to copy task comments to parent incident, but in the task the comments are displayed twice. Any guess why it could be showing two times with in the task? Parent incident shows one time. Appreciate your help!

Thanks

 

 

 

Thanks Abhinay !

It is running as mentioned.

My requiremnt is to display the worknotes on parent as well.

Worknotes from subtask to Task

Worknotes from task to sub-projets

Worknotes for  sub-project to master

pleaase sugges modified BR

 

Abhinay Erra
Giga Sage

Glad you got this working.


Thank you for this script, it works like a charm.


One quick question, how might I modify it so that it writes the project task number to the project (with a link to the project task), so the project manager has a quick way of knowing which project task the note came from?


thanks,


Richelle