How to read files of a folder present on my system and attach all of them in an incident.

haider3
Kilo Contributor

Hi All,

There is one button on my incident page, on-click of that button all the files present in specific folder of my computer should automatically get attach with that incident.

Thanks

H.

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Haider,



You will have to setup a mid server. you can use your own computer as mid-server.


MID Server Installation - ServiceNow Wiki


UI Action Script


1) Initiate a probe to mid server and send the folder/directory location


2) As a parameter to the probe send the record sys_id i.e. record from which ui action is clicked



Mid Server Script Include


1) Receive the folder location and record sys_id


2) Using java code iterate over all the files present under that directory location


3) Using Attachment API upload the individual files to the record sys_id



This will upload all your files to your current record provided the mid server is up.



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,



Can you please help me in this issue, can you provide me the code and the place   where we have to write.



Thanks


H.


Hi Haider,



Steps to be followed:


1) Have a mid server being setup on your computer/laptop


2) Create UI action and call the mid server script include


3) Create MID server script include



Following links can help you for your initial coding


http://wiki.servicenow.com/index.php?title=MID_Server_Script_Includes_Reference#gsc.tab=0


JavascriptProbe and MID Server Script Includes | John Andersen



Hope this helps you. You will have to explore on this on your own and also you need to be somewhat good in java



Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.


Thanks


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader