Export set not working as expected.

Swati44
Kilo Expert

Hi All,

There is one export set, where am exporting data to mid-server every 15 min. In scheduled data export have enabled 'Execute pre script' and adding data from table to staging table. From staging table exporting required fields.And also enable 'Execute post script' so that once the data is exported deleting data in staging table. Delta enable is set false.

Now exporting data to CSV file, now when i check the export history no data present in CSV file.Below is the code am using.

Pre script: 

var ex=new GlideRecord('u_data');
ex.addQuery('u_response_code','100').addOrCondition('u_response_code','700');
ex.query();
while(ex.next()){
var stg=new GlideRecord('u_data_staging');
stg.initialize();
stg.u_device=ex.u_device;
stg.u_collection=ex.u_collection;
stg.u_response_code=ex.u_code;
stg.insert();
}

Post script:

var stg=new GlideRecord('u_data_staging');
stg.query();
while(stg.next()){
stg.deleteRecord();
}

Without executing post scrpit data is loading but post script is needed in order to avoid duplicates.

Thanks all in advance. 

 

1 REPLY 1

Chalan B L
Giga Guru

Hello Swathi,

i recommend to go through this community post

https://community.servicenow.com/community?id=community_question&sys_id=7ba680d9db0997444e1df4621f961987

Where no need to delete the records in the staging table as it is automatically taken care from service now where schedule job and cleans up the data.

still if you need to implement this requirement just follow the below comments

I had the same requirement like once all the data is been inserted all the data needed to be deleted where basically there are steps to execute i recommend you to keep logs and check also go through the docs on post script.

tried the same thing using onComplete transform script no luck even this didn't helped us.

Finally we have implemented this logic in the schedule jobs.

 

Regards,

Chalan