You need to sign in to do that
Don't have an account?
Jason Cooke 2
RenderAs PDF in Service Console - open as a Subtab
I'm looking for a way to open a new subtab in the service console that renders an existing form as a PDF prior to saving the form and without storing the PDF in Salesforce.
I managed to work out how to open the page in a separate window using the commandlink action and target which will open the pdf in a new browser window. My request is to open the PDF as a subtab in the service console. Using the console api the page loads so I lose the data that is entered on the form.
I know that we could have the rendered page save as document or attachment and show that as a subtab. But I would be interested to see if anyone else has had a similar request where the PDF is launched based on form data.
This visualforce markup works by opening the form in a new window:
<apex:commandLink value="Test Action" action="{!test}" target="_blank" styleClass="btn linkAsBtn"></apex:commandLink>
If I use the service console api and pass in the newURL parameter an empty form displays. So I'm looking for a solution where I can invoke the commandlink action and have the target set to a new subtab instead of _blank
I managed to work out how to open the page in a separate window using the commandlink action and target which will open the pdf in a new browser window. My request is to open the PDF as a subtab in the service console. Using the console api the page loads so I lose the data that is entered on the form.
I know that we could have the rendered page save as document or attachment and show that as a subtab. But I would be interested to see if anyone else has had a similar request where the PDF is launched based on form data.
This visualforce markup works by opening the form in a new window:
<apex:commandLink value="Test Action" action="{!test}" target="_blank" styleClass="btn linkAsBtn"></apex:commandLink>
If I use the service console api and pass in the newURL parameter an empty form displays. So I'm looking for a solution where I can invoke the commandlink action and have the target set to a new subtab instead of _blank
<apex:page standardcontroller="Account" extensions="JC1a" deferLastCommandUntilReady="true">
<apex:includescript value="/soap/ajax/30.0/connection.js" />
<apex:includescript value="/support/console/34.0/integration.js" />
<apex:includescript value="{!$Resource.CSA_CustomJQueryResource}" />
<apex:includescript value="{!$Resource.ConsoleAPI}" />
<apex:form id="form1">
<apex:outputPanel >
<script type="text/javascript">
function test1() {
window.open('{!sURL}', '_blank');
}
function consoleOpen() {
strTabURL = '{!sURL}';
strWindow = '_blank';
buttonNewWindow();
}
</script>
</apex:outputPanel>
<apex:inputText value="{!sTest}"/> <!-- This is a test to see if I can show this on the PDF page -->
<apex:commandLink value="Opens in New Window" action="{!test}" target="_blank" styleClass="btn linkAsBtn"></apex:commandLink>
<apex:commandLink value="Button Fails" rerender="form1" oncomplete="consoleOpen();" styleClass="btn linkAsBtn" action="{!test2}"></apex:commandLink>
</apex:form>
</apex:page>
The controller is here:
public class JC1a {
public JC1a(ApexPages.StandardController controller) {
}
public static string sTest {get; set; }
public PageReference test() {
PageReference pg = new PageReference('/apex/JC1aa');
return pg;
}
public string sURL { get; set; }
public PageReference test2() {
PageReference pg = new PageReference('/apex/JC1aa');
sURL = pg.getUrl();
return null;
}
}
The 2nd page which renders as a PDF is here:
<apex:page standardcontroller="Account" extensions="JC1a" renderAs="pdf" deferLastCommandUntilReady="true"> <apex:form > <apex:outputText value="Result: {!sTest}"/> </apex:form> </apex:page>
The tab will open fine, it just isnt displaying the text