Journal_input not saving data through script

ajitchandragiri
Giga Expert

Hi all,

we have a custom table with few fields. Requirement is to the change one of the String fields (say Review comment u_review_comments) to a Journal input field to track changes to this field. I created a new Journal_input field. Its working fine. Now, i need to copy the values of Review Comment string field (max length=1000) to this new field u_review_comment . i wrote the following script and ran it in background scripts. Its not working. Any input is appreciated. I am in Helsinki patch 11.

var csi = new GlideRecord('XXX');

//csi.addQuery('u_number', 'CSI0001043');

csi.query();

while(csi.next()){

gs.print('count ' + csi.getRowCount());

var comment = csi.u_review_comments;

gs.print('comment ' + comment);

csi.u_review_comment = comment;

csi.update();

}

the rowcount and comment variable have data show data, the value is just not coming over to journal field meaning its not showing in activity. If i just pass a string like csi.u_review_comment = 'testing'; it works.

1 ACCEPTED SOLUTION

sethivarun
Kilo Guru

hi Ajit,


use the following :



var csi = new GlideRecord('XXX');


//csi.addQuery('u_number', 'CSI0001043');


csi.query();


while(csi.next()){


gs.print('count ' + csi.getRowCount());


var comment = csi.u_review_comments;


gs.print('comment ' + comment);


csi.u_review_comment.setJournalEntry(comments);


csi.update();


}



i have replaced csi.u_review_comment = comment; with csi.u_review_comment.setJournalEntry(comments);nts);




Please mark it as correct if helpful



Pk


View solution in original post

5 REPLIES 5

that worked. thanks a lot.