Audience
  • Developers
  • Form Designers
Required Knowledge
  • SmartObjects
  • K2 Workflow Designer in particular the Send E-mail Event

Introduction

Files and images can be attached to the Send E-mail event. This Knowledge Base article describes how to attach files and images to the E-mail.

Implementation Details

On the E-mail screen of the Send E-mail event, files and images can be attached by dragging an item from the Context Browser.

Image

The following items are supported:

  • SmartObject methods that return images or files.
  • Item References of type SharePoint Document or InfoPath Document.
  • InfoPath Form attachments (i.e. dragging the attachments node from the InfoPath Form schema).
  • Data Fields.
  • Attachments from the File Inline Functions node information can be found at:

    K2 blackpearl>Designing>Designers>K2 Designer for Visual Studio>Design Tools>Inline Functions>Function Browser>Files Functions

Example Scenario

In the scenario below we will be using a SmartObject method to attach an image to an E-mail. Follow the steps below to set up the scenario as described above.

  1. Create a SmartObject with a property of type Image. Make sure to select the option Allow this SmartObject to be used in Workflows on the Details screen of the SmartObject Designer.
    Image
  2. Auto-generate an Item View, Editable List View and Form from the SmartObject
  3. Create a K2 Designer Workflow from the Form.
  4. Complete the Workflow Settings details of the wizard. Deselect the option to create an Item Reference. Click Next.
  5. Add a Data Field called ClientID of type Integer. Click Next.
    Image
  6. Select the Rule when Create Button is Clicked of the Client Item View to start the workflow.
    Image
  7. Map the ID from the Client Item View to the Data Field.
    Image
  8. Finish the wizard.
  9. Drag a Send E-mail event onto the canvas.
  10. Complete the details as required then open the Context Browser and navigate to the SmartObject created. Drag the Image Load method into the Attachments field.
    Image
  11. Map the ClientID Data Field to the ID as shown below.
    Image
  12. Click OK.
  13. Save and deploy the workflow.
  14. Run the Form and add a new entry on the Client Item View, then click Create.
    Image
  15. An E-mail is sent to the recipient with the image attached.
    Image