Skip to main content

Quote File Service (QFS)

It is common to want to add some files from DynaMaker to another system, for example a CPQ, when a configuration is completed or a quote changes status. While using the client-side postMessage API is the most simple way of sending quotation files between DynaMaker and your other systems, it is not always possible to use. If the files need to be generated and sent at some point after the user has ended their browser session, Quote File Service can be used to generate the files on the server via a simple REST API.

The first step in setting up QFS for your DynaMaker application is to enable its plugin in the dashboard. For that:

  • Go to Plugins in your app dashboard and look for the Quote File Service plugin.
  • Open Settings, enable the plugin and click on Save.
  • See the API Key generated for further use.

When the plugin has been enabled, we can access the PLUGINS.QFS namespace which has a function called onJobRequest - a job is explained in more detail in here. As the first argument we specify which task we want to implement. This is just a name that we choose, for example generate-pdf. The second argument is a callback function that returns a base64-encoded data URL for that task.

In the example code below, the task is generate-pdf and the function uses the DynaMaker Drawing class to generate a PDF as a data URL:

PLUGINS.QFS.onJobRequest('generate-pdf', async (config) => {
await ACTIONS.updateConfiguration(config)
const drawing = ACTIONS.generateQuotationDrawing()
return drawing.generatePdfDataUrl()
})

See that ACTIONS.updateConfiguration() would work as a function that takes config as the data sent by the system and we would update the DynaMaker components accordingly. As an example, if using the Elfsquad plugin, this config would be the raw data sent by the CPQ system, which would be of the type PLUGINS.ELFSQUAD.ElfsquadConfiguration.

If you want to send plain text (txt, json, xml) you must first encode it, for example with the btoa function:

PLUGINS.QFS.onJobRequest('generate-bom', (config) => {
return btoa(ACTIONS.getBomText(config))
})