Business rule error for updating comments as additional comments

Gopal14
Tera Contributor

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();
    }
 
Gopal14_0-1717053163849.png

 

Can you please help

7 REPLIES 7

The issue is that 'case' is not seen as a field. Please validate that this really is the way the tables are linked. 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Jitendra Diwak1
Kilo Sage

Hi @Gopal14,

 

Please check the addQuery in your line no 5. You need the pass the linking between them both table. Suppose we have parent child incident then query should be addQuery('parent_incident', current.sys_id); Do the same in your query.

 

Please accept my solution if it works for you and thumps.

 

Thanks

Jitendra

Please accept my solution if it works for and thumps up.

charan11
Tera Contributor

Hi Gopal14

 

If you want to copy the incident comments to Case Table record. Firstly you have to make sure the case is linked to incident. Unless its linked we can`t copy the comments and we can`t write the Query for this. If the incident is linked to Case Table. Please let us know the field name of case in incident table. so can help with the correct addQuery.