Update RITM work notes after data import and Close complete the RITM

Vishnupriya15
Tera Contributor

I have created a Catalog Item for automating the data import of devices in the alm_hardware table.

Import set table name : u_copy_refresh_automation

 

1. Created a Catalog item - Name- XYZ

2. Created a data source and transform map - to create new Bulk catalog item named as- ABC

3. Created a scheduled import

4. Created business rule to copy attachment from RITM to Datasource and run schedule import.

 

The above scenario is working fine

 

Please help in the scripting below final requirement:

 

After the data import, copy the import status from sys_import_set_run table to the RITM work notes (XYZ - catalog) and mark the RITM as "Closed Complete".

 

I need to close the XYZ catalog item RITM which I submitted initially 

 

@Ankur Bawiskar 

3 REPLIES 3

Vengadesh
Tera Guru

If you are utilizing the flow designer, create a custom action and query the transform history table and return the history as outputs, if so, you can access them as pills, using the update record action, update the Worknotes field and also the state of the RITM.

Also you can use get attachments from record and copy attachment actions to get the attachments from RITM and can easily move to datasource

 

Best regards

Vengadesh

Hi,

I have done this through Business rule, also I have to update work notes and close the RITM which I created initially and not the triggered RITM's (which is Created a Catalog item - Name- XYZ)

Hi,@Vishnupriya15 

 

Getting the transform history:

1.Create a BR on the transform history table, add your static import set table and transform map as a condition to trigger the BR

2.Within the BR, query the RITM table and find your RITM and update the state and work notes 

 

Sample script:

BR condition: Transform map |is| {your transform map} AND State |is| Complete or complete with errors

Script:

 

 var createdTime = current.sys_created_on;
 
    updateReq = new GlideRecord("sc_req_item");
    updateReq.addEncodedQuery("cat_item=Data import^sys_created_on<=" + createdTime);
    updateReq.orderByDesc("sys_created_on")
    updateReq.setLimit(1);
    updateReq.query();
    if (updateReq.next()) {
        updateReq.comments_and_work_notes= Dot walk history using current
        updateReq.state="7";
        updateReq.update()
    }

Try this and let me know if it works 

Thanks,

Vengadesh