Hello Friends,
This error come while we send email with attachment from business center
The Tenant Media does not exist. Identification fields and values: ID='{00000000-0000-0000-0000-000000000000}'
Reason for this error is attachment instream variable we try use is blank and doesn't contain any data.
So avoid this error we need to take dummy instream variable and check it contain any data or not.
see below sample code.
Var
Instr2: InStream;
Instr2_Chk: InStream;
Dummy instream variable use
TempBlob1_lCdu.CreateOutStream(Out1);
ReportInvHdr_lRec.Reset;
ReportInvHdr_lRec.SetRange("No.", "No.");
Clear(PostedSalesInvWithoutTax_lRpt);
PostedSalesInvWithoutTax_lRpt.SetEmailRun_gFnc;
PostedSalesInvWithoutTax_lRpt.SetTableview(ReportInvHdr_lRec);
PostedSalesInvWithoutTax_lRpt.UseRequestPage(false);
PostedSalesInvWithoutTax_lRpt.SaveAs('', REPORTFORMAT::Pdf, Out1);
TempBlob1_lCdu.CREATEINSTREAM(Instr1);
TempBlob1_lCdu.CREATEINSTREAM(Instr1_Chk); //Dummy instream variable
to check it contain any value
While send email we check instream have value
we read instream value in dummy text variable and verify that contain any values
ReadTextChk_lTxt := '';
Instr1_Chk.ReadText(ReadTextChk_lTxt);
IF ReadTextChk_lTxt <> '' THen
EmailMessage.AddAttachment(FirstPDFName_lTxt, 'PDF', Instr1);
if you add above condition then issue will solve.
Thank you for reading...
Keep Sharing....Keep Growing....
No comments:
Post a Comment