When you want to use InterFormNG templates you can either use the standard workflow of InterFormNG2 e.g. the basic create components.
The limitation with these components is, that you need to know exactly what kind of output, that you want (e.g. pdf, print or email) and you also need to know all the parameters e.g. what printer to use, what the PDF file is to be called and the email receiver(s).
All of these parameters (meta data keys) can be set in InterFormNG templates, so in order to reduce the required changes in the InterFormNG templates to a minimum you can consider to build a generic sub-workflow (a workflow, that can be called by other workflows).
Below we will build a generic sub-workflow, that can be called after a merge with an InterFormNG template into the intermediate format.
The merge should be done with the workflow component: From ITPL to intermediates. Before you call the generic workflow you need to set all predefined variables (same as meta data keys in InterFormNG), that are needed.
First you create a new workflow with the input type, From other workflow and intermediate as the input payload.
The workflow below will branch out with a multicast workflow element to print, create a PDF or email.
Remember to click the save icon on the upper right, to save any change of the workflow.
In this setup we assume, that your InterFormNG template as set a dynamic value for the user defined workflow variable, mediaType (which of course is a predefined meta data key in the InterFormNG template), so the generic workflow need execute multiple conditions to verify which of the outputs, that are requested (the mediaType could contain multiple outputs), so we insert the basic, special multicast component:
Now click the '+' icon to the right of the multicast component to add the first choice (condition) to verify, if the mediaType indicates, that a print output should be generated. Now the workflow looks like this:
In this case we dont need the otherwise branch, so we can delete it:
Now we can double click the when element above to insert a condition to verify if the output should be printed:
As the Xpath expression a condition has been inserted to verify if 'print' is found in the mediaType variable. If so, then we want to print. We click apply:
To the right of the When:Print element we now want to insert a print workflow component in order to print the merged result. The print data stream (driver print, idp, pcl or zpl) is selected indirectly via the printer:
The printer must be selected by setting the predefined variable (or meta data key inside the InterFormNG template) before calling this workflow.
Click the marked, rightmost icon and then the magnifying glass to refer to built in variables:
Scroll down and select the predefined variable above: interform.destination.printer.printerName:
- and click apply.
Now we can add a new choice branch under the multicast to test, if a PDF file should be created in a similar condition:
For the PDF file we need to add two components: First to create a PDF file (in the payload of the workflow) and another component to output the PDF file to the file system:
The create PDF has no parameters as the input payload is intermediate (so no template is required), and the to file system component refers to the predefined variables:
Again the variables (or meta data keys in the InterFormNG template) must be set before calling the workflow.
The workflow now looks like this:
Now it gets more tricky. We need to build up the elements of the email as everything is to be dynamic. So these components are used:
1.Set a condition/choice for the new branch in multicast.
2.Set the name of the attachment.
3.Create the PDF into the payload.
4.Put the payload into the attachment.
5.Create the email message text. Remember: RTF files are not supported and variables are referenced with a preceding $-sign: $variable in the email templates.
6.Email details are to be set e.g. who is the receiver.
7.Finally the email is to be sent via a mail server.
The details of each of the components are included below:
The condition:
Set name of attachment:
Create PDF to payload: (Notice, that there are no parameters as the input here is intermediate)
Payload to attachment:
Create email text: (Remember, that rtf files are not supported and variables must be referenced as $variable)
Email details:
To email server:
The workflow now looks like this: