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.

Some example task of use:

  • task generate-pdf to generate a PDF as data URL:
PLUGINS.QFS.onJobRequest('generate-pdf', async (config) => {
await ACTIONS.updateConfiguration(config)
const drawing = ACTIONS.generateQuotationDrawing() // generates SKYDRAWING.Drawing
return drawing.generatePdfDataUrl()
})
  • task generate-step to generate a STEP as data URL:
PLUGINS.QFS.onJobRequest('generate-step', async (config) => {
await ACTIONS.updateConfiguration(config)
const assemblyComponent = ACTIONS.getAssemblyComponent()
const geometryToStep = assemblyComponent.generateGeometry()
const stepData = await PLUGINS.DAS.generateSTEPFile(geometryToStep)
return stepData.generateDataUrl()
})

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 default JavaScript function btoa function:

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