How to get the current request number via transform map scripts

santy1
Giga Contributor

We are loading a excel (by data source and transform map) which contains datas to create multiple RITM's and I want to get the parent REQ number via transform map script. Is it possible?

6 REPLIES 6

Harneet Sital
Mega Sage
Mega Sage

Hi Santhosh,



Since you are creating new RITM's using data load sheets, you would be either providing Request number while uploading or adding the RITM to a specified Request else the record will be added without any associated request number.



To get an object of the current request number in the script you can use, target.request which an object pointing to current record's request number.


source.importset_fieldname = target.request ;


Hi Harneet,



Thanks for your reply.



The RITM and REQ numbers will be auto numbered, So in template it is not necessary to provide those details.



Regards,


Santosh


Santhosh,



In that case, use can access these values in a onAfter or onComplete type of scripts using target.request.


Thanks for your reply Harneet.



I have used encoded query which returns the currently created (filter cond: created - on - current minute) record. Below is the script used:



var scRequest = new GlideRecord("sc_request");


scRequest.addEncodedQuery('cat_item=8007022adb633640rb6bf7951d96196d^sys_created_onONCurrent minute@javascript:gs.minutesAgoStart(0)@javascript:gs.minutesAgoEnd(0)');


scRequest.query();


while(scRequest.next()){


target.request = scRequest.sys_id;


gs.log("scRequest3" +target.request);



}