How to send attachmet to 3rd party system through Base64

shaik_irfan
Tera Guru

Hi,

Currently we are integrating with 3rd party system through cutom spoke and flow designer for incident table, we need to pass the attachment to them, they have shared the request body in which we need to share the attachment as shown below

 

[{ "DataBase64": "", "NR": 0, "FileName": ""}]

 

Can anyone please help me how to send the attachment in above format??

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use script action in flow designer and get the base64 encoded string; then return that as string and use it in next step

Sample script here for scoped app

var gr = new GlideRecord('sys_attachment');
gr.get('3fd6017407d3dc50540bf2508c1ed027');

var sysAtt = new GlideSysAttachment();

var base64Data = sysAtt.getContentBase64(gr);

gs.info(base64Data);

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can use script action in flow designer and get the base64 encoded string; then return that as string and use it in next step

Sample script here for scoped app

var gr = new GlideRecord('sys_attachment');
gr.get('3fd6017407d3dc50540bf2508c1ed027');

var sysAtt = new GlideSysAttachment();

var base64Data = sysAtt.getContentBase64(gr);

gs.info(base64Data);

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

hariharanvl_0-1685769786818.png

I tried to create a script step with the code above but output is empty

@hariharanvl 

can you post a new question and tag me there as this is an older thread?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@hariharanvl ; did you get it working?