Genpact Cora Knowledge Center

Support

Configure Email Conversation Type

V9.4.1

Overview

Email Conversation type is a part of the case management reusable components added to Cora SeQuence. The Email Conversation type uses the Email Component to allow composing and sending ad-hoc emails from within the forms, and the Conversation Component helps display the incoming and outgoing emails.

NOTE
You can use the Email Composer as a stand-alone component embedded in a form, or can couple it with the Conversations View component in a Solution.

Configure Email Composer

  1. In the Administration site, click and open a Solution from the list.
  2. In the Solution Components section, click Email Composer.
  3. In the Email Component window, 
    1. Add a valid default "Address - From" email address.
      This address is used when no From address(es) are provided while calling the Email Composer. An invalid address displays an error. 
    2. Add valid "Addresses - To" email address(es) for recipients' auto complete selection.
      This list is used for the To, Cc, and Bcc fields, and is managed and displayed as a grid where you can add, edit or delete email addresses.
    3. Add, edit or delete email templates.
      These templates help user standardize an email format, and are created as a Cora SeQuence expression.
      You need to have the master workflow configured to use its properties like activities, variables, and metadata in the message body and subject. The workflow properties are displayed on the right panel.
    4. Add, edit or delete email signatures.
      These signatures help user standardize an email signature.

IMPORTANT
As a developer, make sure no part of the expression fails in runtime. This will lead the entire expression to fail, and send a corrupt email with no subject and/or email body.
It is advisable to use if and try functions as much as possible.

Configure Email Sender job

With Email Composer, you need to configure a JES job to send emails. The emails are sent asynchronously. 

  1. Go to, Administration > Global Settings > Jobs Management, and click Add Job.
  2. Select Email Sender as job type.
  3. Click Create.
  4. Edit the Job tab, as required.
  5. On the Command tab, add:
    1. Fetch Batch Size: Number of emails to be included in single batch.
      Batch includes emails in "InQueue" state, or in "Sending" state for longer than Abandoned Timeout.
    2. Abandoned Timeout: Time to allow a conversation item to remain in "Sending" state before it is considered as "abandoned", and ready to be fetched again.
    3. Polling Interval: Time to wait between each database query to fetch conversation items with "InQueue" state and abandoned emails.
    4. SMTP Connection Name: Name of the SMTP connection to use. It is defined in the General tables > SMTP connections.
    5. Max. Retry Count: Number of retries to run before abandoning the batch and failing the job.
    6. Max Retry Interval: Time to wait between consecutive retries of the same email.
    7. Email TTL: Time for an email conversation item to stay in the "InQueue" state.
  6. On the Advanced tab, define the job execution schedule.
  7. Click Finish.

Adding incoming emails to the Conversation View through built-in command

You can use the Create Conversation Item built-in-command to insert incoming emails into the Conversations View. 

  1. Add a Built-In Command activity.
  2. Select Conversation Operations > Create Conversation Item.
  3. Add the following:
    • workflowInstanceId
    • conversationItemState: should be Incoming, but can be any state.
    • createdByUserId
  1. Select the type as Email Conversation Item, and add the following command parameters:
    • From
    • To
    • CC
    • BCC
    • Subject
    • Body
      Example: IIF({EmailListenerActivityName}.Email.HasBodyHtml, {EmailListenerActivityName }.Email.PreviewBodyHtml, {EmailListenerActivityName }.Email.BodyText)
    • Attachments
      File name example: {Listener1}.Email.AllAttachments.Last().FileName
      AllAttachments combines the email attachments and the msg/eml file that was created by the Email Listener.

IMPORTANT
To execute built-in-command that writes into the Conversations View, make sure you have Execute permissions in the master workflow.
To use Conversations View in a sub-workflow, the WF instance Id parameter should be mapped to the master workflow instance Id.

Use Email Composer in Cora SeQuence forms

You can add Email Composer in your forms, in the following two ways:

  • Add the Conversations View: With this you get all of the email functionalities.
    For more details, see this article.

  • Manage the Email Composer controls independently, through Client API within the forms.
    For details, see the section below.

Manage Email Composer through client API

  1. Add or edit a form or task activity in a workflow.
  2. Add the following script to the form source.
    <script type="text/javascript">
      function OnNewMailButtonClientClicking(sender, args) {
        var parameters = {
          wfId: '<%= { wf.WorkflowInstanceId } %>',
          windowTitle: 'New Message',
          from: "absd1@gmail.com,apgd@gmail.com",
          to: "john.smith@genpact.digital,mack.ben@pnmsoft.com",
          cc: "john.smith@genpact.digital,mack.ben@pnmsoft.com",
          bcc: '',
          template: 'SignatureTemplate',
          subject: 'Email Composer Subject',
          signature: 'ben sign alias',
          body: 'Hello',
          //disabledFields: ['from', 'cc', 'bcc', 'template', 'subject','signature']
          disabledFields: ['signature']
        };
        var uniqueId = SEQComponents.Email.open(parameters);
        args.set_cancel(true);
      }


      function OnExistingMailButtonClientClicking(sender, args) {
        var parameters = {
          wfId: '<%= { wf.WorkflowInstanceId } %>',
          uniqueId: "F8C8FC17-86E4-40F9-85CC-C1555DA47A94"
        }
        SEQComponents.Email.open(parameters);
        args.set_cancel(true);
      }


      function OnReplyMailButtonClientClicking(sender, args) {
        var parameters = {
          wfId: '<%= { wf.WorkflowInstanceId } %>',
          replyToId: "18C01D1F-2947-4CDB-BE0E-3056598ECFFA"
        }
        SEQComponents.Email.open(parameters);
        args.set_cancel(true);
      }


      function OnForwardMailButtonClientClicking(sender, args) {
        var parameters = {
          wfId: '<%= { wf.WorkflowInstanceId } %>',
          forwardedFromId: "18C01D1F-2947-4CDB-BE0E-3056598ECFFA"
        }
        SEQComponents.Email.open(parameters);
        args.set_cancel(true);
      }
    </script>


NOTE
Only the workflows that are in the context of a Solution support Email Composer.

For general client API information on all conversation items including Email Composer, see the Conversations View client API section in this article.

For Email Composer, you can use the following args object parameters:

  • args.detail.parameters.windowTitle: Specifies the title of the Email Composer window.
  • args.detail.parameters.from: Specifies the list of email addresses a user can select from. This parameter overrides the pre-configured From email address. The first item is set as the default From address.
  • args.detail.parameters.template: Applies a selected template.
  • args.detail.parameters.signature: Applies a selected signature template.
  • args.detail.parameters.to: Adds a list of To addresses.
  • args.detail.parameters.cc: Adds a list of Cc addresses.
  • args.detail.parameters.bcc: Adds a list of Bcc addresses.
  • args.detail.parameters.subject: Specifies the email subject. The subject is overwritten if an email template is set.
  • args.detail.parameters.body: Specifies the email body. The body is overwritten if an template is set.

NOTE
The From, To, Cc, and Bcc lists should use a comma ‘,’ to separate between items.

Available email states

StateCause
DraftWhen a user saves an email.
InQueueWhen a user sends a draft or an undelivered email.
SendingWhen an Email Sender job fetches the email batch and tries to send them to the email server.
SentWhen the Email Sender job succeeds to send an email.
UndeliveredWhen the Email Sender job fails to send an email and has received an error on email message level.
IncomingWhen an email is received in the system.
Make sure to update through built-in-command.

V9.4

Overview

Email Conversation type is a part of the case management reusable components added to Cora SeQuence. The Email Conversation type uses the Email Component to allow composing and sending ad-hoc emails from within the forms, and the Conversation Component helps display the incoming and outgoing emails.

NOTE
You can use the Email Composer as a stand-alone component embedded in a form, or can couple it with the Conversations View component in a Solution.

Configure Email Composer

  1. In the Administration site, click and open a Solution from the list.
  2. In the Solution Components section, click Email Component.
  3. In the Email Component window, 
    1. Add a valid default "Address - From" email address.
      This address is used when no From address(es) are provided while calling the Email Composer. An invalid address displays an error. 
    2. Add valid "Addresses - To" email address(es) for recipients' auto complete selection.
      This list is used for the To, Cc, and Bcc fields, and is managed and displayed as a grid where you can add, edit or delete email addresses.
    3. Add, edit or delete email templates.
      These templates help user standardize an email format, and are created as a Cora SeQuence expression.
      You need to have the master workflow configured to use its properties like activities, variables, and metadata in the message body and subject. The workflow properties are displayed on the right panel.

IMPORTANT
As a developer, make sure no part of the expression fails in runtime. This will lead the entire expression to fail, and send a corrupt email with no subject and/or email body.
It is advisable to use if and try functions as much as possible.

Configure Email Sender job

With Email Composer, you need to configure a JES job to send emails asynchronously. 

  1. Go to, Administration > Global Settings > Jobs Management, and click Add Job.
  2. Select Email Sender as job type.
  3. Click Create.
  4. Edit the Job tab, as required.
  5. On the Command tab, add:
    1. Fetch Batch Size: Number of emails to be included in single batch.
      Batch includes emails in "InQueue" state, or in "Sending" state for longer than Abandoned Timeout.
    2. Abandoned Timeout: Time to allow a conversation item to remain in "Sending" state before it is considered as "abandoned", and ready to be fetched again.
    3. Polling Interval: Time to wait between each database query to fetch conversation items with "InQueue" state and abandoned emails.
    4. SMTP Connection Name: Name of the SMTP connection to use. It is defined in the General tables > SMTP connections.
    5. Max. Retry Count: Number of retries to run before abandoning the batch and failing the job.
    6. Max Retry Interval: Time to wait between consecutive retries of the same email.
    7. Email TTL: Time for an email conversation item to stay in the "InQueue" state.
  6. On the Advanced tab, define the job execution schedule.
  7. Click Finish.

Add Email Composer to Cora SeQuence forms

You can add Email Composer in your forms, in the following two ways:

  • Add the Conversations View
    With this you get all of the email functionalities. For more details, see this article.

  • Manage the Email Composer controls independently through Client API within the forms.

Manage Email Composer through client API

  1. Add or edit a form or task activity in a workflow.
  2. Add the following script to the form source.
<script type="text/javascript">
      function OnNewMailButtonClientClicking(sender, args) {
        var parameters = {
          wfId: '<%= { wf.WorkflowInstanceId } %>',
          title: 'New Message',
          from: "johnk@genpact.com;",
          to: "mark.smith@genpact.digital;john.smith@pnmsoft.com",
          cc: "jack.fellow@genpact.digital",
          bcc: '',
          template: 'rat',
          subject: 'Email Composer Subject',
          body: '',
          //disabledFields: ['from', 'to', 'cc', 'bcc', 'template', 'subject']
        };
        var messageId = SEQForms.EmailComposer.open(parameters);
        args.set_cancel(true);
      }
      function OnExistingMailButtonClientClicking(sender, args) {
        var parameters = {
          wfId: '<%= { wf.WorkflowInstanceId } %>',
          messageId: <Guid>,
          template: "rat"
        }
        SEQForms.EmailComposer.open(parameters);
        args.set_cancel(true);
      }
      function OnReplyMailButtonClientClicking(sender, args) {
        var parameters = {
          wfId: '<%= { wf.WorkflowInstanceId } %>',
          replyToId: <Guid>,
          subject: 'Email Composer Subject',
          template: 'rat'
        }
        SEQForms.EmailComposer.open(parameters);
        args.set_cancel(true);
      }
      function OnForwardMailButtonClientClicking(sender, args) {
        var parameters = {
          wfId: '<%= { wf.WorkflowInstanceId } %>',
          forwardToId: <Guid>
        }
        SEQForms.EmailComposer.open(parameters);
        args.set_cancel(true);
      }
    </script>


NOTE
Email Composer is supported only in workflows that are in the context of a Solution.

For general client API information on all conversation items including Email Composer, see the Conversations View client API section in this article.

For Email Composer, you can use the following args object parameters:

  • args.detail.parameters.windowTitle: Specifies the title of the Email Composer window.
  • args.detail.parameters.from: Specifies the list of email addresses a user can select from. This parameter overrides the pre-configured From email address. The first item is set as the default From address.
  • args.detail.parameters.template: Applies a selected template.
  • args.detail.parameters.to: Adds a list of To addresses.
  • args.detail.parameters.cc: Adds a list of Cc addresses.
  • args.detail.parameters.bcc: Adds a list of Bcc addresses.
  • args.detail.parameters.subject: Specifies the email subject. The subject is overwritten if an email template is set.
  • args.detail.parameters.body: Specifies the email body. The body is overwritten if an template is set.

NOTE
The From, To, Cc, and Bcc lists should use a comma ‘,’ to separate between items.

Adding incoming emails to the Conversation View through built-in command

You can use the Create Conversation Item built-in-command to insert incoming emails into the Conversations View. 

  1. Add a Built-In-Command activity.
  2. Select the category as Conversation Operations and command as Create Conversation Item.
  3. Add:
    • workflowInstanceId
    • conversationItemState: should be Incoming, but can be any state.
  1. Select the type as Email Conversation Item, and add the following command parameters:
    • From
    • To
    • CC
    • BCC
    • Subject
    • Body
      (example: IIF({EmailListenerActivityName}.Email.HasBodyHtml, {EmailListenerActivityName }.Email.PreviewBodyHtml, {EmailListenerActivityName }.Email.BodyText))
    • Attachments

IMPORTANT
To execute built-in-command that write into the Conversations View, make sure you have Execute permissions in the master workflow.

Available email states

StateReason/Cause for the state
DraftWhen a user saves an email.
InQueueWhen a user send a draft or undelivered email.
SendingWhen an Email Sender job fetches the email batch, and tries to send them to the email server.
SentWhen the Email Sender job succeeds to send an email.
UndeliveredWhen the Email Sender job fails to send an email, and received an error on email message level.
IncomingWhen an email is received in the system
Make sure to update through built-in-command