Updating the RITM fields using cart API is not working

Krika
Kilo Contributor

Hi,

I need to update the RITM fields for which I'm using a BR with cart api, but RITM fields are not getting updated.
Here is my BR condition:

find_real_file.png
here is my script:

find_real_file.png
I need this to parent field to be updated on my RITM and request table also how to achieve this?

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

BR is on sn_customerservice_case table

So you want this case record to be populated inside the RITM's parent field and REQ parent field?

If yes then this can be done

after line 13 query RITM and REQ and update; like this

(function executeRule(current, previous /*null when async*/) {

    // Add your code here
    
    var ritm = new GlideRecord('sc_req_item');
    ritm.get('request', rc.sys_id);
    ritm.parent = current.getUniqueValue();
    ritm.update();
    
    var req = ritm.request.getRefRecord();
    req.parent = current.getUniqueValue();
    req.update();
    

})(current, previous);

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

7 REPLIES 7

SumanthDosapati
Mega Sage
Mega Sage

You are writing an Insert business rule and condition as Product changes.

How will the product value change when its insert.

May be that's why its not running.

 

Regards,

Sumanth

Hi,

I even tried by removing that condition still it is not getting updated

ryan_pope
Mega Guru

Is this business rule running on the RITM that you're trying to update? Or are you trying to submit a new RITM and then update things? If the latter, what table is the BR running on?

Krika
Kilo Contributor

My BR is running on Case table (sn_customerservice_case).
find_real_file.png