Text001 Do you want to overwrite existing attachment? Text002 Import attachment. Text003 Update attachment. Text004 No attachment in current document. Text005 Attachment File %1 imported successfully. Text006 Do you want to delete the attachment in %1?
IF RecordExist(RecIDToImport) THEN EXIT; 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);
SETRANGE("Primary Key",RecIDToExport); SETRANGE("Line No.",RecLineNo); SETRANGE("Name of the File",RecNameofFile); IF NOT FINDFIRST THEN ERROR(Text004); CALCFIELDS(Attachment); IF NOT Attachment.HASVALUE THEN ERROR(Text004); TempBlob.Blob := Attachment; FileManagement.BLOBExport(TempBlob,FORMAT('*' + Extension + ''),TRUE);
SETRANGE("Primary Key",RecIDToDelete); IF NOT FINDFIRST THEN ERROR(Text004); CALCFIELDS(Attachment); IF Attachment.HASVALUE THEN IF CONFIRM(Text006,FALSE,RecIDToDelete) THEN DELETE;
CALCFIELDS(Attachment); IF NOT CONFIRM(Text001) THEN EXIT; Filename := FileManagement.BLOBImportWithFilter(TempBlob,Text002,'','*.*|','*.*'); IF Filename = '' THEN EXIT; Attachment := TempBlob.Blob; "Name of the File" := FileManagement.GetFileName(Filename); Extension := '.' + FileManagement.GetExtension(Filename); MODIFY; IF Attachment.HASVALUE THEN MESSAGE(Text005,Filename);
SETRANGE("Primary Key",RecIDToCheck); IF NOT FINDFIRST THEN EXIT(FALSE); UpdateAttachment(RecIDToCheck); EXIT(TRUE);
AttachmentRecRef.OPEN(DATABASE::"Purch. Request Header"); AttachmentRecRef.SETPOSITION(GETPOSITION); AttachmentRecID := AttachmentRecRef.RECORDID; AttachmentRecRef.CLOSE; AttachmentManagement.ImportAttachment(AttachmentRecID);AttachmentManagement."Document No." := "No.";
AttachmentRecRef.OPEN(DATABASE::"Purch. Request Header"); AttachmentRecRef.SETPOSITION(GETPOSITION); AttachmentRecID := AttachmentRecRef.RECORDID; AttachmentRecRef.CLOSE; AttachmentManagement.ExportAttachment(AttachmentRecID);
AttachmentRecRef.OPEN(DATABASE::"Purch. Request Header"); AttachmentRecRef.SETPOSITION(GETPOSITION); AttachmentRecID := AttachmentRecRef.RECORDID; AttachmentRecRef.CLOSE; AttachmentManagement.DeleteAttachment(AttachmentRecID);