Service Portal - Record Produer
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I have a requirement: As soon as user attaches file in out of the box attachment, then data in the file should be stored in a variable which is multi line text.
10 REPLIES 10
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
you can handle this after record producer is submitted using after insert BR on your target table and then grab the attachment, parse it to get content and store in that variable
(function executeRule(current, previous) {
var gr = new GlideRecord("sys_attachment");
gr.addQuery('table_sys_id', current.sys_id);
gr.query();
if (gr.next()) {
var gsa = new GlideSysAttachment();
var base64 = GlideBase64.encode(gsa.getBytes(gr));
current.variables.variableName = GlideStringUtil.base64Decode(base64);
current.update();
}
})(current, previous);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
