How to get import set run status in RITM Worknotes?

Kavithan A1
Tera Contributor

How to get import set run status in RITM Worknotes?

I have created data source, transform maps, scheduled import and flow designers. the only requirement is to update the import set run log to ritm work notes. 

5 REPLIES 5

Community Alums
Not applicable

Hello,

Could you please refer below thread if it helps -

https://community.servicenow.com/community?id=community_question&sys_id=41f20dc2dbb0411007ab82630596...

 

 

Regards,

Akshay

Hi Akshay,

Thanks for the solution. can you please elaborate the process?

Thanks in advance

 

Pari5
Tera Contributor

Hi Kavithan, Did you get a chance to find a solution for this requirement? I am trying to achieve the same, any inputs will be highly appreciated. Thanks!

Hello Pari,

If you want to update the Import set number on RITM when the RITM are being created using the Import set then you can use something like below code in your onBefore Transform script:

You need to set ignore = true when action == "insert" otherwise the RITM will be created in sc_req_item table incorrect if your target table is sc_req_item on Transform map.

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
    if (action == "insert")
        ignore = true;
    var cartid = "cart_" + gs.generateGUID(); // along with gs.generateGUID() we should append "cart_". This can be used as unique id for the Cart.
    var cart = new sn_sc.CartJS(cartid);
    var request = {
        "sysparm_id": "04b7e94b4f7b4200086eeed18110c7fd",
        "sysparm_quantity": "1",
        "variables": {
            "acrobat": source.u_acrobat + "",
            "photoshop": source.u_photoshop + "",
			"Additional_software_requirements": source.u_additional_s_e_requirements
        },
        "sysparm_cart_name": cartid // Use "sysparm_cart_name" to set the Cart ID for this cart. This was something that was not clear to me.
    };
    var cartRequest = cart.orderNow(request);
    var requestId = "";
    if (cartRequest.request_number) {
        var scReqItem = new GlideRecord("sc_req_item");
        if (scReqItem.get("request", cartRequest.request_id)) {
            scReqItem.work_notes = "RITM created by Import set process " + import_set.number;
            scReqItem.update();
        }
    }
})(source, map, log, target);

Please mark this helpful/correct, if it answer your question.

Thanks