Hello All,
I have this customization to make where a BLOB data type (ie. any attachment file) to be sent from tenant database to master database within NAV. I can only use C/AL code for sending data to master company from tenant company. I have managed to convert the attachment file to a BigText data but could not assign that BigText data to a published web service page field. Also, other data are being assigned to published page except for the attachment field. What am I missing here?
Below is the function I used for getting and setting the attachment file. Any help would be appreciated.
GetIssueAttachment(EntryNo_ : Integer;TenantID : Code[30];CompanyNameText : Text[30];AttachmentEncoding : BigText)
IssueAttachment.RESET;
IssueAttachment.SETRANGE("Tenant ID",TenantID);
IssueAttachment.SETRANGE("Entry No.",EntryNo_);
IssueAttachment.SETRANGE("Company Name","Company Name");
IF NOT IssueAttachment.FINDFIRST THEN
EXIT;
IssueAttachment.CALCFIELDS(Attachment);
IF NOT IssueAttachment.Attachment.HASVALUE THEN
EXIT;
IssueAttachment.Attachment.CREATEINSTREAM(IStream);
MemoryStream := MemoryStream.MemoryStream();
COPYSTREAM(MemoryStream, IStream);
bytes := MemoryStream.ToArray();
AttachmentEncoding.ADDTEXT(Convert.ToBase64String(bytes));
SetIssueAttachment(EntryNo : Integer;TenantID : Code[30];CompanyNameText : Text[30];lines : Text)
IssueAttachment.RESET;
IssueAttachment.SETRANGE("Tenant ID",TenantID);
IssueAttachment.SETRANGE("Entry No.",EntryNo);
IssueAttachment.SETRANGE("Company Name",CompanyNameText);
IF NOT IssueAttachment.FINDFIRST THEN
EXIT;
bytes := Convert.FromBase64String(AttachmentEncoding);
MemoryStream := MemoryStream.MemoryStream(bytes);
IssueAttachment.Attachment.CREATEOUTSTREAM(OutStr);
MemoryStream.WriteTo(OutStr);
IssueAttachment.MODIFY;
*This post is locked for comments