When I apply a filter on a report request page and is it possible to get the same filter while sending the email
for eg: I have added a custom report action for job ordrer confitmation on the job card and I have a custom email function to send the job order confirmation , so what i planning is to get the filter that i applied in the report request page to the email sending attachment with the same filtered data . is it posssible !! I Have tried with adding a request page before sending a email and its working but now iam trying to get the filters as same as preview of the report ..is it possible , to add the preview option to the new request page any help will be great, Thanks in advance.
Hi, yzhums I was taking reference from your blog
https://yzhums.com/7200/ . Is it possible to get the same filters applied in the request page in to our new added request page and add the preview option
XmlParameters := Report.RunRequestPage(50114, PageParameter); by this
Its a custom Email send function
JobL.Reset(); JobL.SetRange("No.", Rec."No."); if JobL.FindFirst() then begin ReportSelections.Reset(); ReportSelections.SetRange(Usage, "Report Selection Usage"::JS); if ReportSelections.FindFirst() then begin Customer.Reset(); Customer.SetRange("No.", Rec."Bill-to Customer No."); if Customer.FindFirst() then begin Recipients.Add(Customer."E-Mail"); if Recipients.Count <> 0 then begin XmlParameters := report.RunRequestPage(50114); if (XmlParameters <> '') then begin Message('xmlparameter%1', XmlParameters); TempBlob.CreateOutStream(OutS); RecRef.GetTable(JobL); Report.SaveAs(ReportSelections."Report ID", XmlParameters, ReportFormat::Pdf, outs, RecRef); TempBlob.CreateInStream(InS); AttachmentTextL := AttachmentLbl; SPCSetFileName(AttachmentTextL, Rec); Attachment := StrSubstNo(AttachmentTextL, Rec."No."); Subject := StrSubstNo(SubjectLbL, Rec."No."); EmailMsgL.Create(Recipients, Subject, '', true); EmailMsgL.AddAttachment(Attachment, 'application/pdf', InS); EmailL.OpenInEditor(EmailMsgL, Enum::"Email Scenario"::JobShipment);
As per above code, if there is nothing generated in the report with Saveas function no code will run, is that your query or something else?
if Customer.FindFirst() then begin Recipients.Add(Customer."E-Mail"); if Recipients.Count <> 0 then begin TempBlob.CreateOutStream(OutS); RecRef.GetTable(JobL); XmlParameters := Report.RunRequestPage(50114); if not Report.SaveAs(50114, XmlParameters, ReportFormat::Pdf, outs, RecRef) then begin TempBlob.CreateInStream(InS); AttachmentTextL := AttachmentLbl; SPCSetFileName(AttachmentTextL, Rec); Attachment := StrSubstNo(AttachmentTextL, Rec."No."); Subject := StrSubstNo(SubjectLbL, Rec."No."); EmailMsgL.Create(Recipients, Subject, '', true); EmailMsgL.AddAttachment(Attachment, 'application/pdf', InS); EmailL.OpenInEditor(EmailMsgL, Enum::"Email Scenario"::JobShipment); end; end; end; End;
Now the email window is not getting open,where i went wrong
Hi
You have to write your all code like this
if Report.saveas...... then
begin
your all code goes here....
end;
Hi, Thank you for the support, but still its proceeding,
Hi,
you can try that
if not report.SaveAs() then
if Recipients.Count <> 0 then begin TempBlob.CreateOutStream(OutS); RecRef.GetTable(JobL); Report.SaveAs(50114, ReportParameter, ReportFormat::Pdf, outs, RecRef); ReportParameter := ''; ReportParameter := Report.RunRequestPage(50114); TempBlob.CreateInStream(InS); AttachmentTextL := AttachmentLbl; SPCSetFileName(AttachmentTextL, Rec); Attachment := StrSubstNo(AttachmentTextL, Rec."No."); Subject := StrSubstNo(SubjectLbL, Rec."No."); EmailMsgL.Create(Recipients, Subject, '', true); EmailMsgL.AddAttachment(Attachment, 'application/pdf', InS);
Thanks for the replies, I have added , Runrequestpage, but when i click on cancel still its proceeding to email, how can i stop that.
Hi, just adding to Mohana's reply.
If some filters on the report request page are variables, maybe you need to manually save it into a Text type field.
Hope this helps as well.
Thanks.
ZHU
If I understood correctly then yes, you can store the filters into a text variable using the below line and you can use the text variable in the email or report layout etc.
AppliedFilter := Recordvariable.GetFilters();
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156