Você está visualizando o conteúdo de ajuda da versão:
You can use the Assign Task step to create and assign tasks to a user or group. When a task is assigned to a user or group, an email notification is sent to the defined user or to each member of the defined group. A typical email notification contains link of the assigned task and information related to the task.
You can use metadata in an email template to dynamically populate information in an email notification. For example, the value of the title, description, due date, priority, workflow, and last date in the following email notification is selected dynamically at the runtime (when an email notification is generated).
Metadata is stored in key-value pairs. You can specify the key in the email template and the key is replaced with a value at the runtime (when an email notification is generated). For example, in the below code sample, "$ {workitem_title} " is a key. It is replaced with value “Loan-Request” at the runtime.
subject=Task Assigned - ${workitem_title} message=<html><body>\n\ <table style="width: 480px; font-family: Helvetica, Arial, sans-serif; border: 0; padding: 0; vertical-align: top; text-align: left; word-wrap: break-word; margin: 16px auto; color:#323232; background-color:#FFFCF9; border-collapse: collapse;">\n\ <tbody>\n\ <tr>\n\ <td style="height: 100px; width: 480px; background-color: #FFE0CB; border-top: 5pt solid black; font-family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 15px; line-height: 20px; padding: 12px; color: #707070;">\n\ Sample Company\n\ </td>\n\ </tr>\n\ <tr>\n\ <td style="font-family: Helvetica, Arial, sans-serif; height: auto; background-color: #FFFCF9; padding: 32px 16px 20px 16px; ">\n\ <pre style="font-size: 13px; font-family: Helvetica, Arial, sans-serif; font-weight: normal; color: #323232;"> Hello ${workitem_assignee},\n\ The following task has been assigned to you:</pre>\n\ </td>\n\ </tr>\n\ <tr>\n\ <td style="width: 480px;">\n\ <table style="height: auto; width: 480px; background-color:#FFFBF9; font-family: Helvetica, Arial, sans-serif; border-collapse: collapse;">\n\ <tbody>\n\ <tr style="border-bottom: solid 2px #FFFCF9;">\n\ <td style="font-family: Helvetica, Arial, sans-serif; width: auto; height: auto; background-color:#FFF5EF; font-weight: bold; font-size: 11px; line-height: 20px; padding: 12px; color: #707070;"> TITLE</td>\n\ <td style="font-family: Helvetica, Arial, sans-serif; background-color:#FFF5EF; text-align: left; vertical-align: middle; height: auto; font-weight: normal; font-size: 13px; line-height: 20px; padding: 10px 16px 10px 32px; color: #323232;">\n\ <p>${workitem_title}</p>\n\ </td>\n\ </tr>\n\ <tr style="border-bottom: solid 2px #FFFCF9;">\n\ <td style="font-family: Helvetica, Arial, sans-serif; width: auto; height: auto; background-color:#FFF5EF; font-weight: bold; font-size: 11px; line-height: 20px; padding: 12px; color: #707070;"> DESCRIPTION</td>\n\ <td style="font-family: Helvetica, Arial, sans-serif; background-color:#FFF5EF; text-align: left; vertical-align: middle; height: auto; font-weight: normal; font-size: 13px; line-height: 20px; padding: 10px 16px 10px 32px; color: #323232;">\n\ <p>${workitem_description}</p>\n\ </td>\n\ </tr>\n\ <tr style="border-bottom: solid 2px #FFFCF9;">\n\ <td style="font-family: Helvetica, Arial, sans-serif; width: auto; height: auto; background-color:#FFF5EF; font-weight: bold; font-size: 11px; line-height: 20px; padding: 12px; color: #707070;"> DUE DATE</td>\n\ <td style="font-family: Helvetica, Arial, sans-serif; background-color:#FFF5EF; text-align: left; vertical-align: middle; height: auto; font-weight: normal; font-size: 13px; line-height: 20px; padding: 10px 16px 10px 32px; color: #323232;">\n\ <p>${workitem_due_date}</p>\n\ </td>\n\ </tr>\n\ <tr style="border-bottom: solid 2px #FFFCF9;">\n\ <td style="font-family: Helvetica, Arial, sans-serif; width: auto; height: auto; background-color:#FFF5EF; font-weight: bold; font-size: 11px; line-height: 20px; padding: 12px; color: #707070;"> PRIORITY</td>\n\ <td style="font-family: Helvetica, Arial, sans-serif; background-color:#FFF5EF; text-align: left; vertical-align: middle; height: auto; font-weight: normal; font-size: 13px; line-height: 20px; padding: 10px 16px 10px 32px; color: #323232;">\n\ <p>${workitem_priority}</p>\n\ </td>\n\ </tr>\n\ <tr>\n\ <td style="font-family: Helvetica, Arial, sans-serif; width: auto; height: auto; background-color:#FFF5EF; font-weight: bold; font-size: 11px; line-height: 20px; padding: 12px; color: #707070;"> WORKFLOW</td>\n\ <td style="font-family: Helvetica, Arial, sans-serif; background-color:#FFF5EF; text-align: left; vertical-align: middle; height: auto; font-weight: normal; font-size: 13px; line-height: 20px; padding: 10px 16px 10px 32px; color: #323232;">\n\ <p>${workitem_workflow}</p>\n\ </td>\n\ </tr>\n\ </tbody>\n\ </table>\n\ </td>\n\ </tr>\n\ <tr style = "text-align: center; vertical-align: middle;">\n\ <td style="padding:48px 0 72px 0;"> \n\ <a href="${workitem_url}" target="_blank" style="background-color: #1EBBBB; font-size: 18px; line-height: 25px; font-weight: bold; color: #FFFFFF; text-decoration: none; padding: 15px 15px 15px 15px;">Open Task</a>\n\ </td>\n\ </tr>\n\ <tr>\n\ <td style="border-top: solid 1px #EDEAE7; padding: 16px;">\n\ <p><span style="font-size: 12px; font-weight: normal; font-style: italic; color: #919191;">This is an automatically generated email. Please do not reply to this email.</span></p>\n\ </td>\n\ </tr>\n\ </tbody>\n\ </table>\n\ </body>\n\ </html>\n\
An AEM Forms application provides several metadata variables (key-value pairs) out of the box. You can use these variables in an email template. The value of the variable is based on the associated forms application. The following table lists all the metadata variables available out of the box:
Key | Description |
workitem_title | Title of the associated forms application. |
workitem_url | URL to access the associated forms application. |
workitem_description | Description of the associated forms application. |
workitem_priority | Priority specified for the associated forms application. |
workitem_due_date | Last date to act on the associated forms application. |
workitem_workflow | Name of the workflow associated with the forms application. |
workitem_assign_timestamp | Date and time when the workflow item was assigned to the present assignee. |
workitem_assignee | Name of the present assignee. |
host_prefix | URL of the author server. For example, http://10.41.42.66:4502 |
publish_prefix | URL of the publish server. For example, http://10.41.42.66:4503 |
You can also use custom metadata in an email notification. Custom metadata contains information in addition to system-generated metadata. For example, policy details retrieved from a database. You can use an ECMAScript or OSGi bundle to add custom metadata in crx-repository:
ECMAScript is a scripting language. It is used for client-side scripting and server applications. Perform the following steps to use ECMAScript to add custom metadata for an email template:
-
Add code to the .ecma file that has the logic to generate custom metadata in key-value pairs. For example, the following ECMAScript code generates custom metadata for an insurance policy:
function getUserMetaData() { //Commented lines below provide an overview on how to set user metadata in map and return it. var HashMap = Packages.java.util.HashMap; var valuesMap = new HashMap(); valuesMap.put("policyNumber", "2017568972695"); valuesMap.put("policyHolder", "Adobe Systems"); return valuesMap; }
You can use the WorkitemUserMetadataService Java interface to add custom metadata for email templates. You can create an OSGi bundle that uses the WorkitemUserMetadataService Java interface and deploy it to the AEM Forms server. It makes the metadata available for selection in the Assign Task step.
To create an OSGi bundle with Java interface, add AEM Forms Client SDK jar and granite jar files as external dependencies to the OSGi bundle project. You can use any Java IDE to create an OSGi bundle. The following procedure provides steps to use Eclipse to create an OSGi bundle:
-
Add source code that uses WorkitemUserMetadataService Java interface to add custom metadata for email templates. A sample code is listed below:
package com.aem.impl; import com.adobe.fd.workspace.service.external.WorkitemUserMetadataService; import org.apache.felix.scr.annotations.Component; import org.apache.felix.scr.annotations.Properties; import org.apache.felix.scr.annotations.Property; import org.apache.felix.scr.annotations.Service; import org.osgi.framework.Constants; import java.util.HashMap; import java.util.Map; @Component @Service @Properties({ @Property(name = Constants.SERVICE_DESCRIPTION, value = "A sample implementation of a user metadata service."), @Property(name = WorkitemUserMetadataService.SERVICE_PROPERTY_LABEL, value = "Default User Metadata Service")}) public class WorkitemUserMetadataServiceImpl implements WorkitemUserMetadataService { public WorkitemUserMetadataServiceImpl() {} public Map<String, String> getUserMetadataMap() { HashMap<String, String> metadataMap = null; metadataMap = new HashMap(); metadataMap.put("test_metadata", "tested-interface implementation"); return metadataMap; } }