Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function executeRule(current, previous /*null when async*/) {
- var inc = new GlideRecord('incident');
- var currentID;
- if(!inc.get('sys_id', current.table_sys_id)){
- return;
- }
- var mitakaID;
- var incID = new GlideRecord('u_mitaka_integrates_table');
- if(incID.get('u_local_sysid', current.table_sys_id)){
- mitakaID = incID.u_mitaka_sysid + '';
- currentID = incID.u_local_sysid + '';
- } else {
- return;
- }
- var arr = [];
- var attach = {
- fileName: current.file_name + '',
- contentType: current.content_type + '',
- incidentID: mitakaID + '',
- currentID: currentID + '',
- //data: new GlideStringUtil().base64Encode(new GlideSysAttachment().getBytes(current))
- data: 'derp1'
- };
- var attach1 = {
- fileName: 'wazaaaaa.jpg',
- contentType: current.content_type + '',
- incidentID: mitakaID + '',
- currentID: currentID + '',
- //data: new GlideStringUtil().base64Encode(new GlideSysAttachment().getBytes(current))
- data: 'derp2'
- };
- arr.push(attach);
- arr.push(attach1);
- var obj = {
- endpoint: 'https://dev80273.service-now.com/api/343127/receiveattachment/integration/attachment',
- method: 'POST',
- username: 'admin',
- password: 'P@ssw0rd',
- body: JSON.stringify(arr)
- };
- gs.log("ATTACH: " + obj.body);
- var attachment = new RESTRequest();
- var res = attachment.sendREST(obj);
- gs.log('RESPONSE::::::' + JSON.stringify(res));
- })(current, previous);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement