Script to remain leading zeroes of a number in pre-export script

Nur1
Tera Contributor

Hi Community,

 

I'm facing an issue with the string type field which is removing the leading zeroes of a number when exporting report to mid server in csv file format.

Example, the employee number 00123, after export the report to mid server using export set, the number updated as "123".

 

Appreciate if someone could provide a script in export set pre-export script to add apostrophe in front of the number so that the leading zeros remain.

1 ACCEPTED SOLUTION

Try changing the table to a database view and running it.
 
var gr = new GlideRecord(tableName);
↓
var gr = new GlideRecord(viewName);

View solution in original post

6 REPLIES 6

Hi Hiroshi,

I've tried using your script in Scheduled Exports > Execute pre-export script. Unluckily the apostrophe still not appended in the employee_number field once the report generated to mid server. Is there any other script that would make this works ?

 

Thanks.

Try changing the table to a database view and running it.
 
var gr = new GlideRecord(tableName);
↓
var gr = new GlideRecord(viewName);