Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How do I email a specific page

Avatar

Level 1

Hello everyone

Quick question should be easy for an experienced javascripter. I have a multipage document and I have created a button to submit to email. Below is the code I am  using.

Please help me with making it so that only the page that the button is on is submited by the email.

Thanks in advance.

Code:

var subject = MainPage.RadioButtonList.rawValue;

var myDoc = event.target;

try {

    myDoc.mailDoc({

        bUI: false,

        cTo: 'myemail', // Replace with actual receiver mail address.

        cSubject: subject,

        cSubmitAs: "PDF"

    });

} catch (e) {

    // exception handling...

}

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Email functionality will only email the document/PDF.

As a workaround, you could place script in the mouseUp event of the Email button that hides all pages and then shows the required page.

You could do this using the presence property. There are some exmples here: http://assure.ly/kyMP6l and http://assure.ly/iWzzPg.

Hope that helps,

Niall

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi,

Email functionality will only email the document/PDF.

As a workaround, you could place script in the mouseUp event of the Email button that hides all pages and then shows the required page.

You could do this using the presence property. There are some exmples here: http://assure.ly/kyMP6l and http://assure.ly/iWzzPg.

Hope that helps,

Niall

Avatar

Level 1

Excellent Niall,

I stumbled on that myself yesterday and it mostly works perfectly, except for one minor detail.

I can hide every page from the layout except the first page, when I choose to hide that page with the script it still gets emailed in the form though it is blank. What I really need is for the form to be a single page when it is emailed. I have tried a few ways, is there a reason that the first page can't be hidden from the layout?

Thanks.

Avatar

Level 10

Hi,

I suspect that the first page uses a different master page. If this is the case, then hiding page1, will still mean an instance of the first master page is rendered.

The other issue could be your pagination settings. For example, if page2 is set to Top of New Page, then this is what will be rendered. Try, Follow Previous.

Hope that helps,

Niall