Read the content of an Excel File and upload it into ServiceNow tables
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2017 06:03 AM
Hi,
I am trying to develop a piece of code in ServiceNow which automatically uploads the data of the Excel file into ServiceNow existing tables, through Bisiness Rule. But I am facing some issues with the package constructor. Please find below the script I used for getting the content of the file. It would be really appreciable, if someone has performed this activity and could share their views and code snippet which might be very helpful for me. I have gone through multiple discussion in community and tried all the solution, but no luck nothing worked for me to get rid of this error.
Instance Platform: Istanbul
Script:
StringUtil = GlideStringUtil;
sa = new GlideSysAttachment();
gs.addInfoMessage('Found Attachment.');
var bytesContent = sa.getBytes('sc_req_item', current.sys_id);
tempdata = String(Packages.java.lang.String(bytesContent));
strData = tempdata.replaceAll("&", "&");
Error:
"The choice of Java constructor java.lang.String matching JavaScript argument types (null) is ambiguous; candidate constructors are: String(java.lang.StringBuilder) String(java.lang.StringBuffer) String(byte[]) String(char[]) String(java.lang.String) (sys_script.90106950db233200605d712ebf9619fe.script;"
Thanks,
Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2017 06:12 AM
Why don't you use the data import option, having this excel as a data source?
Import a translation from an Excel spreadsheet
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2017 06:14 AM
Hi Arun,
Why are you doing in this manner.
Why not use Data source to load data in target table?
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2017 06:28 AM
Same thing I was wondering:)
http://wiki.servicenow.com/index.php?title=Importing_Data_Using_Import_Sets#gsc.tab=0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2017 06:32 AM
There are many share solutions available to import an excel into SNOW table.One sample below
https://share.servicenow.com/app.do#/detailV2/385c2ca713767a000de935528144b0db/overview
As others suggested, try using the data source and transform maps for validating excel entries.