- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 06:33 AM
Hello @everyone. Good morning. I need some help reviewing the business rule below and give me advise to correct the issue of the RITM not created and not added to an existing current REQ. I appreciate the help.
------------------
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 07:27 AM
Just sharing the code that I finally was able to make to work just in case it can be useful for others
--------------------
--------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 06:44 AM
Your first line in the function is wrong
var catItemGr = new GlideRecord('sc_cat_item', 'Sailpoint IdN for Service Catalog');
should be
var catItemGr = new GlideRecord('sc_cat_item');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 06:55 AM
Thank you, @Bert_c1 . I think I did the suggestion earlier and it was not executing good. Let me try again with you advise.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 07:02 AM
Hi @Bert_c1 . Change the definition as you suggested and the RITM is not created and REQ not updated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2024 08:52 AM - edited 05-14-2024 08:59 AM
This section of code has problems:
// Add the RITM to the current active REQ
var reqRecord = new GlideRecord('sc_request');
reqRecord.addQuery('number', current.request.number);
reqRecord.query();
if (reqRecord.next())
{
gs.info("Line 35 <SP_SPNT_SN_INT_ManualConfigRITM>-Parent REQ returned " + reqRecord.getRowCount() + " records");
reqRecord.insert(ritmGr.sys_id);
gs.info("Line 37 <SP_SPNT_SN_INT_ManualConfigRITM>-Parent REQ Insert");
reqRecord.update();
gs.info("Line 38 <SP_SPNT_SN_INT_ManualConfigRITM>-Parent REQ Update");
}
where you have reqRcord.insert() (note: there are no arguments to insert()) and an "insert()" makes no sense on a record that exists. So remove that and leave the 'update()'. But then what field are you updating on the sc_request table. The record in sc_req_item uses a reference field to link the record to one in sc_request. just above the ritmGr.insert() add the code section
// Add the RITM to the current active REQ
var reqRecord = new GlideRecord('sc_request');
reqRecord.addQuery('number', current.request.number);
reqRecord.query();
if (reqRecord.next())
{
gs.info("Line 35 <SP_SPNT_SN_INT_ManualConfigRITM>-Parent REQ returned " + reqRecord.getRowCount() + " records");
ritmGr.request = reqRecord.sys_id;
}
before the 'ritmGr.insert();'