How to copy close notes to addition comment while closing the sc task

VIKAS MISHRA
Tera Contributor

As per the requirement when we close the task then the close notes should be auto copied to "additional comment", how can i do this please suggest. 

9 REPLIES 9

Could you please tell me that how can i achive this thorugh BR

Hi @VIKAS MISHRA Please find below for the BR to achieve the same

Eswar4_0-1692103682408.png

Eswar4_1-1692103705269.png

Eswar4_2-1692103877965.png

 

 

(function executeRule(current, previous /*null when async*/ ) {

    var openedBy = current.opened_by;
    var assignmentGroup = current.assignment_group;
    if (assignmentGroup == 'e8c3483c1b118510f48c65f7b04bcb0d' || assignmentGroup == 'ed09322b1b0c4d10680a0e9cdc4bcb43' || assignmentGroup == '551536e91b22cd10680a0e9cdc4bcb6a') {
        current.work_notes = current.comments;
        current.update();

    }
})(current, previous);

 

Please mark it Correct & Hit Like if this works!

Regards,

Eswar Chappa

I have tried beow mentioned script its still not working, when i try to copy the close notes to description or short descruptio then its working fine but not working only for additional comment, please suggest 

 

 

(function executeRule(current, previous /*null when async*/ ) {

    var openedBy = current.opened_by;
    var assignmentGroup = current.assignment_group;
    if (assignmentGroup == 'e8c3483c1b118510f48c65f7b04bcb0d' || assignmentGroup == 'ed09322b1b0c4d10680a0e9cdc4bcb43' || assignmentGroup == '551536e91b22cd10680a0e9cdc4bcb6a') {
		current.comments = current.close_notes;
        current.update();
    }
})(current, previous);

Hello, 

 

Remove the if conditions in your script and set those groups in the 'When to Run' tab. Additionally, remove the current.update() as this is not best practice. Try the script below:

 

(function executeRule(current, previous /*null when async*/) {

	var notes = current.close_notes;
	current.work_notes.setJournalEntry(notes);
	current.comments.setJournalEntry(notes);

})(current, previous);

 

Kind Regards,

(function executeRule(current, previous /*null when async*/ ) {

    var openedBy = current.opened_by;
    var assignmentGroup = current.assignment_group;
    if (assignmentGroup == 'e8c3483c1b118510f48c65f7b04bcb0d' || assignmentGroup == 'ed09322b1b0c4d10680a0e9cdc4bcb43' || assignmentGroup == '551536e91b22cd10680a0e9cdc4bcb6a') {
var cn=current.close_notes;
current.comments =cn.toString();
        current.update();
    }
})(current, previous);