is it possible to send attachment through transform map?

jobin1
Tera Expert

Hi All

My requirement is business will be encoding the attachment and sending that encoded value in excel format and the same we need to decode and transfer to ritm form via transform map.

So is it possible to do so? if yes how?. what transform script we need to use to achieve this functionality 

1 ACCEPTED SOLUTION

Hi,

So you can use this in global scope

(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
	// Add your code here
	var fileName = source.u_file_name;
	var fileContentType = source.u_content_type; // such as image/jpeg or application/pdf
	var fileData = source.u_base64_data;

	var ecc = new GlideRecord('ecc_queue');
	ecc.initialize();
	ecc.agent = "AttachmentCreator";
	ecc.topic = "AttachmentCreator";
	ecc.name = fileName + ":" + fileContentType;
	ecc.source = target.sys_class_name + ":" + target.sys_id;
	ecc.payload = fileData;
	ecc.insert();

})(source, map, log, target);

Regards
Ankur

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

View solution in original post

32 REPLIES 32

@Ankur Bawiskar 

I am attaching the detailed information what I have done in 2 instances.

In instance 'A' I used this business rule

RAJUMANGA_0-1685689060449.pngRAJUMANGA_1-1685689121464.png

And I am sending the attachment infomation onto staging table in instance 'B'

Here I am getting the encoded information like this:

RAJUMANGA_2-1685689261614.png

After that I wrote the transform script which you mentioned by doing some changes

RAJUMANGA_3-1685689386463.png

Are you seeing any mistakes in these things. Can you check it once, Kindly please?

Thanks 

Regards

Raju Manga

@RAJU MANGA 

can you create a new question and tag me there and include all the details?

This thread is quite old.

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

@Ankur Bawiskar 

ok 

Thanks 

Regards

Raju Manga