- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 08:57 AM
Hello everyone,
I'd like the last comment of my task to be sent to the request's commenters. Currently, it's only getting the string "Request for additional information:" but can't get the value.
Here's the script I created for the UI action:
if (gs.nil(current.comments)) {
gs.addErrorMessage("The 'Additional Comments' field is required");
current.setAbortAction(true);
}
current.state = '5';
current.update();
var num = current.parent;
if (num) {
var numGR = new GlideRecord('x_acel2_csc_register');
if (numGR.get(num)) {
numGR.u_stage = '4';
numGR.state = '5';
numGR.comments = "Request for additional information:" + current.comments;
numGR.update();
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 09:03 AM
Hi @jkelvynsant ,
try this
if (gs.nil(current.comments)) {
gs.addErrorMessage("The 'Additional Comments' field is required");
current.setAbortAction(true);
}
current.state = '5';
current.update();
var num = current.parent;
if (num) {
var numGR = new GlideRecord('x_acel2_csc_register');
if (numGR.get(num)) {
numGR.u_stage = '4';
numGR.state = '5';
numGR.comments = "Request for additional information:" + current.comments.getJournalEntry(1);
numGR.update();
}
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 10:00 AM
Hi @jkelvynsant ,
To get the comments you need to use getJournalEntry() function.
Replace the second last line of code with below code snippet.
numGR.comments = "Request for additional information:" + current.comments.getJournalEntry(1); //Latest comment
//If you want all the commnents then need to use .getJournalEntry(-1), when doing only once.
Thanks,
Bhimashankar
---------------------------------------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful'. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 09:03 AM
Hi @jkelvynsant ,
try this
if (gs.nil(current.comments)) {
gs.addErrorMessage("The 'Additional Comments' field is required");
current.setAbortAction(true);
}
current.state = '5';
current.update();
var num = current.parent;
if (num) {
var numGR = new GlideRecord('x_acel2_csc_register');
if (numGR.get(num)) {
numGR.u_stage = '4';
numGR.state = '5';
numGR.comments = "Request for additional information:" + current.comments.getJournalEntry(1);
numGR.update();
}
}
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 10:10 AM
Perfect! It worked, thank you very much
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 10:00 AM
Hi @jkelvynsant ,
To get the comments you need to use getJournalEntry() function.
Replace the second last line of code with below code snippet.
numGR.comments = "Request for additional information:" + current.comments.getJournalEntry(1); //Latest comment
//If you want all the commnents then need to use .getJournalEntry(-1), when doing only once.
Thanks,
Bhimashankar
---------------------------------------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful'. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2025 10:11 AM
Perfect! Thank you very much