Custom Print Button in Inventory Transfer

Hello

I need some guidance in setting up a custom print button in the inventory transfer form, I see the form has the printing field but the form itself doesn’t have the print button.

Any help would be appreciated.

Rookie Asked on May 12, 2022 in SuiteScript.
Add Comment
6 Answer(s)

You should be able to add a button using a User Event script.

You’ll also need an accompanying client script to handle the button action.

Please let me know if you need further details.

Intermediate Answered 5 days ago.
Add Comment

Yes, I was able to create the button with a user event. How can I make the CS so the button can call it?

Thanks for answering.

Best

Rookie Answered 5 days ago.
Add Comment

Hi,

First, you need to reference a client script using:

form.clientScriptModulePath = './client_script.js';

When you add the button in the User Event script, there is a functionName argument.

The client script needs to implement that function.

Thanks,

Chris

Intermediate Answered 5 days ago.
Add Comment

I see but what module do I need to use to print? that’s the part I get lost. Now I know how to call the UE but how to print?

Thank you for your time.

Rookie Answered 5 days ago.
Add Comment

Hi,

To do the actual printing you’ll need to use that client script function to call a Suitelet and in the Suitelet, do something like this:

let renderer = render.create();
renderer.setTemplateById({ id:123 });
...
scriptContext.response.addHeader({
    name: 'Content-Type:',
    value: 'application/pdf'
});
scriptContext.response.addHeader({
    name: 'Content-Disposition',
    value: 'inline; filename=”Test.pdf"'
});
scriptContext.response.writeFile(renderer.renderAsPdf());
Intermediate Answered 5 days ago.
Add Comment

Thank you, I’ll try.

Rookie Answered 5 days ago.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor