Send email post function: Manipulating email body

Issue #351 resolved
Patrick Schuh [brainbits] created an issue

Hi Fidel,

I’m wondering if its possible to manipulate the email body with if-functions. I want to delete a complete line when the corresponding value is not set. Something like this:

E-Mail-Body

Due Date: %{XXXXX} Subject: %{000000} customfield XY != NULL ( Custom Field XY: %{10293} )

Best regards Patrick

Comments (4)

  1. Fidel Castro Armario repo owner

    Hi Patrick,

    Currently "Send an email" post-function doesn't only provides basic parsing mode, but you can implement what you intend to do with the following solution:

    1) Use "Copy a parsed text to a field" post-function for composing the variable part of your email body and storing it in "Ephemeral string 1" virtual field. To do it use the following configuration:

    • Target field: Ephemeral string 1
    • Parsing mode: basic
    • Text to be parsed:
    "Due Date: " + %{00012} +
    "\\nSubject: " + %{00000} +
    %{nnnnn} != null ? "\\nCustom Field XY: " + %{nnnnn} : ""
    

    replacing nnnnn with field code for "Custom Field XY".

    2) Use "Send an email" post-function for sending an email, replacing the variable part of your body with field code for "Ephemeral string 1" (i.e, %{00061}).

    Another possible solution, is to compose the whole body of your email using "Copy a parsed text to a field" post-function, storing it in "Ephemeral string 1". Then simply use field code for Ephemeral string 1" as the only content of your email's body in "Send an email" post-function.

  2. Patrick Schuh [brainbits] reporter

    Yes, that works. But I'm not that happy with the workaround via ephemeral strings. When sendind multiple emails its a little bit complex. It would be great to use an "advanced mode" for email-creation.

  3. Fidel Castro Armario repo owner

    I haven't implemented this mode in the "Send an email" post-function because I find it quite awkward to compose a long text using advanced parsing mode, and I would like to provide a more easy way to do it.

    I hope to find a feasible alternative to advanced parsing mode.

  4. Log in to comment