How to get the returned value to client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 09:26 AM
I have the below script, How can I get the value back to client script and set it in form section
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 09:34 AM - edited 12-19-2024 09:34 AM
I think your issue is you have 2 Array and how to return them both
You can make array or Array or JSON here
Eg
var AttachmentParse = Class.create();
AttachmentParse.prototype = Object.extendsObject(AbstractAjaxProcessor, {
process: function() {
var currentSysId = this.getParameter('sysparm_sys_id');
gs.log("currentSysId: " + currentSysId);
var attachment = new GlideSysAttachment();
var getdata = new GlideRecord('sys_attachment');
getdata.addQuery('table_sys_id', currentSysId);
getdata.addQuery('table_name', "ZZ_YYu_bpm");
getdata.query();
if (getdata.next()) {
gs.log("loop");
var attachmentSysID = getdata.sys_id.toString();
var attachmentStream = attachment.getContentStream(attachmentSysID);
var demodata = new sn_impex.GlideExcelParser();
demodata.parse(attachmentStream);
var caseID = [];
var resolvedBy = [];
var finalArr = [];
var headers = demodata.getColumnHeaders();
var header1 = headers[0];
var header2 = headers[1];
while (demodata.next()) {
var row = demodata.getRow();
caseID.push(row[header1]);
resolvedBy.push(row[header2]);
}
finalArr[0] = caseID.toString();
finalArr[1] = resolvedBy.toString();
gs.info("Case ID: " + caseID);
gs.info("Resolved By: " + resolvedBy);
return finalArr;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 09:51 AM - edited 12-19-2024 10:15 AM
I could get the value in client script, how can I set it to form section like below. ( we have this in place already and we enter the value manually, now I want the returned value to be set here automatically.) @Anurag Tripathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2024 01:54 AM
Hey Ana, This is an embedded list, which means this data is on another table and has a reference to current table.
You can't add or modify data here through client script.
I would suggest you do this on the script include itself writing a GlideRecord on this table and updating the record.
On the client script you can just reload the form.