Hi All,
[Version: NAV 2016]
In a customized page, I newly kept an feature for Importing, Exporting and Deleting an attachment. I can able to Import/Export/Delete without any issues in Windows client. When I try to import an attachment from web client, immediately the web page gets closed and am getting below error:
An error has occurred
A server error has occurred, and the content cannot be displayed. Refresh the page or open a new browser window.
Restart ->
In Customized Table: Attachment Table, I wrote below function for Import.
Local variable of ImportAttachment function:
Parameter: RecIDToImport (RecordID)
Variable: AttachRecordRef (RecordRef)[b]ImportAttachment(RecIDToImport : RecordID)[/b]
INIT;
"Line No." := "Line No." + 10000;
"Primary Key" := RecIDToImport;
Filename := FileManagement.BLOBImportWithFilter(TempBlob,Text002,'','*.*|','*.*');
IF Filename = '' THEN
EXIT;
Attachment := TempBlob.Blob;
"Name of the File" := FileManagement.GetFileName(Filename);
Extension := '.' + FileManagement.GetExtension(Filename);
INSERT;
IF Attachment.HASVALUE THEN
MESSAGE(Text005,Filename);
I wrote below code in page OnAction..
Global variables:
AttachmentRecLineNo (Integer)
AttachmentRecNameofFile (Text)
AttachMgmt2 (Record) Attachment TableAttachmentRecRef.OPEN(DATABASE::"Purch. Request Header");
AttachmentRecRef.SETPOSITION(GETPOSITION);
AttachmentRecID := AttachmentRecRef.RECORDID;
AttachmentRecRef.CLOSE;
AttachmentManagement.ImportAttachment(AttachmentRecID);
AttachmentManagement."Document No." := "No.";
AttachmentManagement.MODIFY;
What is missing and can anybody let me know how to sort it out?
Thanks in advance,
Aarvi.
Comments
Just modified the line..
with..
Thanks.
Sorry for the late reply. I do not have any idea as of now. But let me check and let you know.
Thanks.