File content to base64

working on a bulk data upload for sage intacct that will read the contents of a ftp folder and retrieve all the files then upload them to intacct. To upload documents you have to convert the file contents binary data to base64 string and specify the file type.

        <attachment>
            <attachmentname>My Attachment1</attachmentname>
            <attachmenttype>txt</attachmenttype>
            <attachmentdata>aGVsbG8gd29ybGQhIHRoaXMgaXMgYmFzZTY0IGVuY29kZWQgZGF0YQ==</attachmentdata>
        </attachment>

Are there any modules in apiant that will already do this conversion or do you know of a quick way to handle it?

Thanks

Hi Brent,

Yes, see this subassembly in your system: 7f238f81df9d4c68833c77ac1c4306fe

Robert

awesome. I will give it a try.

Thanks

Follow up…

I have all my data set up as needed. One issue I am coming across in on the action to push the data into intacct. Since each upload could contain multiple files, I am using a script to cycle through the value pairs and for each set create an attachment record. great

Issue is that cdata tags get automatically added. Intacct reads those tags as part of the file.

<attachments>
<attachment>
	<attachmentname><![CDATA[AAA TEST]]></attachmentname>
	<attachmenttype><![CDATA[TXT]]></attachmenttype>
	<attachmentdata><![CDATA[dGVzdCB0ZXN0IHRlc3Q=]]></attachmentdata>
</attachment>

Is there a simple way to remove the tags afte the xml is created or to prevent them from being added in the first place? (at least for the data node)

Hi Brent,

I need to see where those CDATA elements are being added.

Please send the assembly UUID and a screenshot where it is happening.

Thanks,

Robert

UUID: 2fd7b4bb9bf54a5c8712d895775dfe05

The attachment data is being passed into the action as a string. the intacct xml is reading the CDATA tag as part of the file data.

Have patched your system with a change to this behavior, such that the node text will be XML-escaped rather than wrapped with CDATA.

You need to clear your browser cache and reload to get the patch.

Thanks. that worked.

OK that worked for one spot but the changes is killing me on another spot. I need you to reverse that patch asap. it took down a few automations for me that i am manually handling the cdata tag.