- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2024 11:05 PM
hI there
has anyone tried this, if so let me know if it works, i tried but could not get it to auto-populate
https://deepakvednegi.medium.com/bulk-upload-mrvs-f48ab544870f
Thanks
Levino
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 02:28 AM
hi @levino ,
yes i have tired this before
in my requirements i have bills and Amount as two variable in MRVS and attachment type with variable name called upload data
Script include:
getXLSBill: function() {
var arrObj = [];
var file_id = this.getParameter('sysparam_attSysId');
var row = '';
var att = new GlideSysAttachment().getContentStream(file_id);
var parser = new sn_impex.GlideExcelParser();
parser.parse(att);
var headers = parser.getColumnHeaders();
while (parser.next()) {
var obj = {};
row = parser.getRow();
obj.bills = row[headers[0]]; // first variable
obj.amount = row[headers[1]]; // second variable
arrObj.push(obj);
}
return JSON.stringify(arrObj);
},
on change client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
try {
parseXLS();
} catch (e) {
alert("Exception caugght in " + e.message);
}
function parseXLS() {
var att = new GlideAjax('getCallersLocalTime');
att.addParam('sysparm_name', 'getXLSBill');
att.addParam('sysparam_attSysId', newValue);
att.getXML(excelParser);
function excelParser(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
g_form.setValue('bill', answer); //bill- name of MRVS
}
}
}
Output:
Please mark helpful & correct answer if it's really worthy for you.
Thanks,
BK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2024 02:28 AM
hi @levino ,
yes i have tired this before
in my requirements i have bills and Amount as two variable in MRVS and attachment type with variable name called upload data
Script include:
getXLSBill: function() {
var arrObj = [];
var file_id = this.getParameter('sysparam_attSysId');
var row = '';
var att = new GlideSysAttachment().getContentStream(file_id);
var parser = new sn_impex.GlideExcelParser();
parser.parse(att);
var headers = parser.getColumnHeaders();
while (parser.next()) {
var obj = {};
row = parser.getRow();
obj.bills = row[headers[0]]; // first variable
obj.amount = row[headers[1]]; // second variable
arrObj.push(obj);
}
return JSON.stringify(arrObj);
},
on change client script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
try {
parseXLS();
} catch (e) {
alert("Exception caugght in " + e.message);
}
function parseXLS() {
var att = new GlideAjax('getCallersLocalTime');
att.addParam('sysparm_name', 'getXLSBill');
att.addParam('sysparam_attSysId', newValue);
att.getXML(excelParser);
function excelParser(response) {
var answer = response.responseXML.documentElement.getAttribute('answer');
g_form.setValue('bill', answer); //bill- name of MRVS
}
}
}
Output:
Please mark helpful & correct answer if it's really worthy for you.
Thanks,
BK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @Bhavya11
can we validate fields from MRVS suppose x field has decimal values when we are manually adding in MRVS so when user is adding value in excel without decimal and after uploading file it should throw an error like add upto 2 decimal places
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago