Business rule error for updating comments as additional comments
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 12:13 AM
Hi,
Below is my BR
var additionalComments = current.comments.getJournalEntry(-1);
var caseGR = new GlideRecord('sn_customerservice_case');
caseGR.addQuery('sys_id', current.case);
caseGR.query();
if (caseGR.next()) {
// Add comments to the related case
caseGR.comments = 'Additional comments from incident: ' + additionalComments;
caseGR.update();
}
Can you please help
7 REPLIES 7
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 12:18 AM
Hi @Gopal14
try the below code
var additionalComments = current.comments.getJournalEntry(-1);
var caseGR = new GlideRecord('sn_customerservice_case');
caseGR.addQuery('sys_id', current.sys_id);
caseGR.query();
if (caseGR.next()) {
// Add comments to the related case
caseGR.comments = 'Additional comments from incident: ' + additionalComments;
caseGR.update();
}
If my answer finds you well, helpful, and related to the question asked. Please mark it as correct and helpful.
Thanks
dgarad
Thanks
dgarad
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 12:22 AM
comments are still not updating as a Additional Comments
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 12:34 AM
Assuming you want the latest comments to sync (not sure what '-1' returns):
var comments = current.comments.getJournalEntry(1);
var caseRec = new GlideRecord('sn_customerservice_case');
caseRec.addQuery('sys_id',current.case.getValue()); // assuming case is the correct field on the incident table
caseRec.query();
if(caseRec.next()){
caseRec.comments = 'Additional comments from Incident ' + comments;
caseRec.update();
}
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 12:37 AM