Can we unzip the the zipped email attachment in Inbound Action script? Or can we write a script to unzip the Data Source attached zip file and process the unzipped files (Which are text files).

ishwar4
Kilo Explorer

Can anyone please help me?

4 REPLIES 4

Ujjawal Vishnoi
Mega Sage
Mega Sage

Hi Ishwar,



You can use Packages.java.util.zip.ZipInputStream to unzip the files.



Hope this helps.



Regards


Ujjawal


Keep in mind that Packages calls haven't been supported since Calgary. They can lead to upgrade issues.


Thanks Ujjawal,


I tried it but I am not getting the required output.



              this.ZipEntry= Packages.java.util.zip.ZipEntry;


              this.ZipInputStream= Packages.java.util.zip.ZipInputStream;


                this.ByteArrayInputStream = Packages.java.io.ByteArrayInputStream;




                      var fileName = grAttach.file_name;


                      var sa = new GlideSysAttachment();


                      var binData = sa.getBytes(grAttach);


                      var stream = new this.ByteArrayInputStream(binData);      


             


              var zipIn = new this.ZipInputStream(stream);


              entry = zipIn.getNextEntry();


       


I am getting entry value as Null.


Can you please let me know where I am wrong?