Application DesignSpecify an Email Address for a Device Connection (XML)

In Devices Devices, you can create a device connection that allows you to print to a PDF file or print to a PNG file and send the file to an email address. When configuring the options on the Connection tab for such a device connection, you can enter email settings that include static values and static patterns. However, for greater flexibility, you can enter the name of a data map entryClosed A name (key) and value pair in the data map for a job. for each of these options instead. You can use a business rule to assign values to those data map entries by using a mapOperations business rule component, and you can change the values as needed.

Tip: For information about configuring these types of device connections, see Create a Print-to-PDF Device Connection or Create a Print-to-Image Device Connection.

When used in conjunction with an appropriate device connection, the following business rule sends PDF files to different email addresses for approval depending on the region for which the label template was designed. In this example, the organization stores label templates for each region in a separate folder in their Loftware Enterprise SP environment. The organization has a print-to-PDF device connection with an Email connection type so that PDF files can be sent via email. For the To option on the Connection tab, the name of a data map entry has been entered rather than a static value or a pattern. The business rule specifies a value for that data map entry.

Note: This business rule requires the existence of a print-to-PDF device connection for which the To option on the Connection tab has a value of ${/Email/Reviewer}. The choice of name has no special significance, but the name entered on the Connection tab and the name used in the business rule must match.

Important! Content in a business rule is case sensitive. This includes business rule component names, attributes, and values.

Tip: If you always want to use the same value for a data map entry when a particular simple process is run, you can specify the value for that data map entry in the process. You do not need to use a business rule unless you also want to implement business logic.

<?xml version="1.0" encoding="UTF-8"?>

<businessRules configuratorSupport="false">

   <businessRule>

 

      <!-- If the PDF is for the Americas region, send the PDF to the Reviewer for that region. -->

      <mapOperations name="SEND_TO_AMERICAS_REVIEWER" namespace="Body">

 

         <!-- Triggered by ENQUEUE event. -->

         <triggers>

            <trigger eventTrigger="ENQUEUE" priority="0"/>

         </triggers>

 

         <!—- Check whether the label template is in the Americas folder. -->

         <executionCondition>

            <equalsIgnoreCase failOnFalseCondition="false">

               <trueLogMessage>*** DETECTED AMERICAS LABEL ***</trueLogMessage>

               <left type="KEY" valueType="STRING">

                  <value>${!DOCUMENT_URL!}</value>

               </left>

               <right type="LITERAL" valueType="STRING">

                  <value>/Default/Label Templates/Americas</value>

               </right>

            </equalsIgnoreCase>

         </executionCondition>

 

         <!-- Specify the email address for the Americas Reviewer. -->

         <operations>

            <operation action="OVERRIDE" dataType="STRING" literalValue="true" operation="PUT">

               <!-- Name (key) for To email address in the Connection tab for the device. -->

               <targetKey>${/Email/Reviewer}</targetKey>

               <value>AmericasReviewer@example.com</value>

            </operation>

         </operations>

 

      </mapOperations>

 

      <!-- If the PDF is for the Europe region, send the PDF to the Reviewer for that region. -->

      <mapOperations name="SEND_TO_EUROPE_REVIEWER" namespace="Body">

 

         <!-- Triggered by ENQUEUE event. -->

         <triggers>

            <trigger eventTrigger="ENQUEUE" priority="0"/>

         </triggers>

 

         <!—- Check whether the label template is in the Europe folder. -->

         <executionCondition>

            <equalsIgnoreCase failOnFalseCondition="false">

               <trueLogMessage>*** DETECTED EUROPE LABEL ***</trueLogMessage>

               <left type="KEY" valueType="STRING">

                  <value>${!DOCUMENT_URL!}</value>

               </left>

               <right type="LITERAL" valueType="STRING">

                  <value>/Default/Label Templates/Europe</value>

               </right>

            </equalsIgnoreCase>

         </executionCondition>

 

         <!-- Specify the email address for the Europe Reviewer. -->

         <operations>

            <operation action="OVERRIDE" dataType="STRING" literalValue="true" operation="PUT">

               <!-- Name (key) for To email address in the Connection tab for the device. -->

               <targetKey>${/Email/Reviewer}</targetKey>

               <value>EuropeReviewer@example.com</value>

            </operation>

         </operations>

 

      </mapOperations>

 

      <!-- If the PDF is for the Asia Pacific region, send the PDF to the Reviewer for that region. -->

      <mapOperations name="SEND_TO_ASIA_PACIFIC_REVIEWER" namespace="Body">

 

         <!-- Triggered by ENQUEUE event. -->

         <triggers>

            <trigger eventTrigger="ENQUEUE" priority="0"/>

         </triggers>

 

         <!—- Check whether the label template is in the Asia Pacific folder. -->

         <executionCondition>

            <equalsIgnoreCase failOnFalseCondition="false">

               <trueLogMessage>*** DETECTED ASIA PACIFIC LABEL ***</trueLogMessage>

               <left type="KEY" valueType="STRING">

                  <value>${!DOCUMENT_URL!}</value>

               </left>

               <right type="LITERAL" valueType="STRING">

                  <value>/Default/Label Templates/Asia Pacific</value>

               </right>

            </equalsIgnoreCase>

         </executionCondition>

 

         <!-- Specify the email address for the Asia Pacific Reviewer. -->

         <operations>

            <operation action="OVERRIDE" dataType="STRING" literalValue="true" operation="PUT">

               <!-- Name (key) for To email address in the Connection tab for the device. -->

               <targetKey>${/Email/Reviewer}</targetKey>

               <value>AsiaPacificReviewer@example.com</value>

            </operation>

         </operations>

 

      </mapOperations>

 

   </businessRule>

</businessRules>