How to get the current request number via transform map scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 03:44 AM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 03:55 AM
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 ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 04:06 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 04:18 AM
Santhosh,
In that case, use can access these values in a onAfter or onComplete type of scripts using target.request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2017 07:55 AM
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);
}