when we are updating and work notes and comment its not printing in logs

sangitakumari
Tera Contributor
when we updated comment and work notes, and  work notes and comment is   not printing in logs. if anyone know kindly let us know. where i am doing wrong in code. Below are the code.
 
 
 
var state = "";
    var specialcomment = "";
    var aworknote = "";
    var acomment = "";
    //var acomment = "";

    // var work_notes = current.work_notes.toString();

    if (current.state.toString() == '2') {
        current.work_notes = "State changed to:" + current.getDisplayValue('state');
        gs.log("work_notes change for state in progress" + current.work_notes);
        //var demistocomment = current.work_notes + current.comments.toString() + specialcomment;
        var demistocomment = current.work_notes;
        gs.log("Work_notes and comment and resolution code and resolution notes" + demistocomment);
    } else if (current.state == '3') {
        if (current.hold_reason == '5' || current.hold_reason == '4' || current.hold_reason == '1') {
            current.work_notes = "State changed to:" + current.getDisplayValue('state') + "and reason is:" + current.getDisplayValue('hold_reason');
            gs.log("work_notes chnage for state" + current.work_notes);
            // demistocomment = current.work_notes + current.comments.toString() + specialcomment;
            demistocomment = current.work_notes;
            gs.log("Work_notes and comment and resolution code and resolution notes" + demistocomment);
        }
    } else if (current.state.toString() == '6' || current.state.toString() == '7') {
        specialcomment = "Resolution Code : " + current.close_code + '\n' + "Resolution Notes : " + current.close_notes;
        state = "Resolved"; //Resolved or Closed
        demistocomment = specialcomment;
        gs.log("Work_notes and comment and resolution code and resolution notes" + demistocomment);
    } else if (current.state.toString() == '8') {
        state = "Rejected"; //Rejected
    } else if (current.work_notes.changes()) {
        var worknote = current.work_notes.getJournalEntry(1);
        var worknoteContent = worknote.toString().split("(Work notes)");
        aworknote = worknoteContent[1].trim();
        demistocomment = aworknote;
        gs.log("printing work notes" + demistocomment);
    } else if (current.comments.changes()) {
        var comment1 = current.comments.getJournalEntry(1);
        var comment2 = comment1.toString().split("(Additional comments)");
        acomment = comment2[1].trim();
        demistocomment = acomment;
        gs.log("printing comment" + demistocomment);
    }
2 REPLIES 2

Appanna M
Tera Guru

Hello @sangitakumari ,

 

Try using the gs.info() or gs.debug() in place of logs and check once. If you are working in a custom scope application gs.log() will not work.

 

Please Mark My Answer as Helpful and Accept as Solution, if you find this article helpful or resolves your issue.

I try with gs.addinfomessage() its not priting message for work notes and comments.