web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Is It possible to get the filters applied on the request page into the Email

(0) ShareShare
ReportReport
Posted on by

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.

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at

    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();

  • Suggested answer
    YUN ZHU Profile Picture
    95,331 Super User 2025 Season 2 on at

    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

  • Community Member Profile Picture
    on at

      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.

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Hi,

    you can try that

    if not report.SaveAs() then

  • Community Member Profile Picture
    on at

    Hi, Thank you for the support, but still its proceeding,

    pastedimage1675671494101v1.png

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    Hi

    You have to write your all code like this

    if Report.saveas...... then

    begin

       your all code goes here....

    end;

  • Community Member Profile Picture
    on at

     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

  • Suggested answer
    Nitin Verma Profile Picture
    21,698 Moderator on at

    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?

  • Community Member Profile Picture
    on at

    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);
                                     

  • Community Member Profile Picture
    on at

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans