Explain the process to create different buttons on...
# ask-stanley-ai
a
Explain the process to create different buttons on a custom record which produce different Advanced PDF templates when clicked
c
AI generated answer (using internal Slack threads):
****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To create different buttons on a custom record which produce different Advanced PDF templates when clicked, you can follow these steps: 1. Create the Advanced PDF Templates: Navigate to
Customization > Forms > Advanced PDF/HTML Templates
. Click on
New Template
and create your templates as per your requirements. 2. Create a Suitelet: This Suitelet will be responsible for rendering the Advanced PDF. You can use the
N/render
module in SuiteScript to render the template. The Suitelet should accept a parameter that determines which template to render. 3. Create the Custom Buttons: Navigate to the custom record type where you want to add the buttons. In the
Forms
subtab, edit the form where you want to add the buttons. In the
Screen Fields
subtab, you can add the custom buttons. For the function that gets called when the button is clicked, you can call the Suitelet you created in step 2. Pass the appropriate parameter to determine which template to render. Here's a simplified example of how the Suitelet might look:
Copy code
javascript
function suitelet(request, response){
    var templateId = request.parameters.templateId; // get the template id from the request parameters
    var renderer = render.create(); // create a renderer
    renderer.templateContent = render.load({id: templateId}).content; // load the template content
    var xml = renderer.renderToString(); // render the template to a string
    response.write(xml); // write the response
}
Remember, this is a simplified example and you might need to adjust it to fit your specific needs. For example, you might need to load the record you want to render the template for and set it on the renderer. Please note that this process involves scripting. If you want to avoid scripting, you could create one advanced PDF template that contains your multiple designs and use specific IF conditions to determine which design is printed based on certain criteria on the record.
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.87596041
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.865775585
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.860021591
Please provide your feedback on this answer.