Previous Topic

Book Contents

Book Index

Next Topic

Info Tab

The 'Info' tab contains a list of all EMF functions that can be used to retrieve content from objects in the database. The functions can be copied from the list and pasted for further use.

Help Image

Available functions:

  • <%emf.getValue(strField)%>

    Function <%emf.getValue(strField)%> retrieves value of the specified attribute of the business object for which the send email action is called (i.e. the object specified on the 'Object Type' Tab).
    Often a structured attribute will be used, as depicted in the 'Email Template Tab' topic, where attribute 'personrequestedby.email' was used to insert the value of 'email' attribute of the 'person' object referenced as 'personrequestedby' by the ticket for which the Send Email action is called.

  • <%emf.getDatetimeValue(strField, strFormat)%>

    Function used to get value from a datetime attribute. Same as <%emf.getValue(strField)%> with added ability to specify datetime format.

    Default datetime format used by email templates is "dd.MM.yyyy HH:mm". Function <%emf.getDatetimeValue(strField, strFormat)%> makes it possible to enter datetime value formatted differently.

    For example, emf.getDatetimeValue("datecreated","yyyy.MM.dd 'at' HH:mm") would give e.g. 2012.12.21 at 06:30

  • <%emf.getValueAndAppendComma(strField)%>

    Function retrieves value of the specified attribute and appends a comma after the value. The intended use is insertion of multiple email addresses.
    If you had N recipients in one address field, you would use this function for first (N-1) addresses and then use <%emf.getValue(strField)%> for the last address.
    In case of 2 recipients, it could look like this:
    <%emf.getValueAndAppendComma("personrequestedby")%> <%emf.getValue("personrequestedfor")%>

    The result would be (for example):

    john@test.com, mary@test.com

    Notice that there is no comma between the functions - it is added by the function <%emf.getValueAndAppendComma(strField)%>
    If there was no email defined for personrequestedby, the function would return an empty string and the result would be (for example):
    mary@test.com

  • <%emf.getCollectionValue(strField, strFilter, strSorting, strColumns, format, separator = "", tableHeader = "", tableFooter = "")%>

    Function retrieves values from objects referenced (by the object type for which the Send Email action is called) as a collection attribute. For example, it could insert a list of selected attributes of individual ticket descriptions belonging to the ticket the email is called for.

    • strField

      Name of the relation attribute containing a collection of objects

    • strFilter

      Condition for filtering of the collection, standard syntax used e.g. in Valuemation full search applies.

      E.g.: <%emf.getCollectionValue("descriptions","statementtype.statementtype=='Work History'","descno descending","descno,dateCreate,statementtype.statementtype,tckShorttext","#%s, %s, %s, %s","\n")%>

    • strSorting

      List of attributes used for sorting of the collection. Ascending sort order is default, for descending order put the word "descending" after the attribute name, e.g.: "lastname descending,firstname".

    • strColumns

      List of referenced objects' attributes returned by this function (Note: do not use spaces in the attribute list!)

      e.g. "lastname,firstname,email"

    • format

      Formatting string for the output.

      - each individual attribute (specified in 'columns') in the output must be represented with one %s

      - for new line use \n, for tabulator use \t

      Example: list of emails sent for a ticket:
      <%emf.getCollectionValue("descriptions.personcreate", "", "lastname descending,firstname", "lastname,firstname,email", "%s, %s\temail=%s\n","")%>
      The result might look like this:
      Lennon, John email=john@test.com
      Kay, Mary email=mary@test.com

    • separator

      String used as line separator. For example, instead of using \n as part of the formatting string, \n could be used as the separator parameter. In such case, _\n would be applied only to the first (N-1) lines.

      Separator could ideally be used to separate individual lines of the collection in some pseudo-graphical way such as multiple dashes. E.g.:

      <%emf.getCollectionValue("descriptions.personcreate", "", "lastname descending,firstname", "lastname,firstname,email", "%s, %s\temail=%s","\n-----\n")%>

      Would result in:

      Lennon, John email=john@test.com

      -----
      Kay, Mary email=mary@test.com

  • <%emf.getValueOf(strBOName, strField)%>

    Function <%emf.getValueOf(strBOName, strField)%> is capable of retrieving attribute values from arbitrary objects, i.e. objects other than the one for which the send email action is called.

    Parameter "strBOName" is code identifying objects in hashmap 'dynamicParamsBag'. Standard readily available hashmap codes are 'bo', ' boMailObject', 'escTypeLevel and 'boEmailBody' (listed as 'Parameters' on the 'Info' tab). Use one of these parameters in place of 'boParamName' in <%emf.getValueOf("boParamName","attr")%> to identify the corresponding object. In place of 'strField', specify the object attribute whose value is to be retrieved by the function.

    We can see that 'emf.getValue(strField)' function is equivalent to 'emf.getValueOf(strBOName, strField)' where 'strBOName' = 'bo'.

  • <%emf.getParam(strParam)%>

    Function <%emf.getParam(strParam)%> is similar to <%emf.getValueOf(strBOName, strField)%>. The difference is that the objects in hashmap 'dynamicParamsBag' are identified by a plain value (string, numeral) instead of a business object - attribute combination.

  • <%emf.showTable(strField, strColumns, strFilter = "", strSorting = "")%>

    Function used to specify an HTML table (when email format is HTML), the output is an HTML table.
    strField - which object type attribute is used as source for the collection
    strColumns - list of columns separated by commas
    strFilter - filtering criteria (optional), "" = no filtering, otherwise specify filtering using standard Valuemation query expressions
    strSorting - table sorting (optional), "" = ascending, "descending" to specify descending order

  • <%emf.setDatetimeFormat(strFormat)%>

    Default datetime format used by email templates is "dd.MM.yyyy HH:mm". Function <%emf.setDatetimeFormat(strFormat)%> can be used to change this default datetime format so that all datetime values in the email are custom-formatted without the need to change their formatting (from the default one) using function <%emf.getDatetimeValue(strField, strFormat)%>.

    This makes it possible to insert datetime values using other "datetime non-specific" functions (emf.getValue... / emf.getCollectionValue...) and still have the inserted datetime values custom-formatted.

    To use the <%emf.setDatetimeFormat(strFormat)%> function, just insert the function (function does not return any values) before other value-returning functions. It is enough to insert the setDatetimeFormat function once, it will influence all datetime values that follow.

    Example:

    Help Image

    Note: The 'emf' functions can also be used in place of a parameter of another function, in this case only the actual name of the function is used, i.e. without '<%emf...>'.

  • <%emw.getPassOnEmail_report_subWf()%>

    This function refers to a namesake workflow 'emw.getPassOnEmail_report_subWf'. This IPC specific workflow can be used in email templates to determine the email address(es) to which an email informing about the ticket having been passed on should be sent. The workflow accepts parameters (separated by commas) from the round brackets in the emw function and returns a string output which is then used (in the email) in the place of the called emw function.

    The function can be used in the To/Cc/Bcc fields of email template and in the Subject and Text fields of email body.

    In general, functions starting with 'emf' call available functions (listed in the 'Info' email template tab), functions starting with 'emw' call Valuemation workflows (these workflows must also start with 'emw' for the function to be able to find them).

Additional information:

Sending an email using the email template functionality is done by a subworflow. The subworkflow can be started e.g. from a status change action or escalation. There are two standard workflows for sending emails from a template:

  • Core.EMP.SendEmailForEmailTemplate_fromEscalatin

    Used for sending emails from escalation

    Help Image

  • Core.EMP.SendEmailForEmailTemplate_Subworkflow

    The actual email sending subworkflow, also part of the 'Core.EMP.SendEmailForEmailTemplate_fromEscalation' workflow.

    This workflow has as its input hashmap 'dynamicParamsBag', containing hashcodes 'bo', 'boMailObject', 'escTypeLevel' and 'boEmailBody' (listed as 'Parameters' on the 'Info' tab).

    The 'emf.getValueOf(strBOName, strField)' function uses these hashcodes (used as parameter strBOName) to get objects from the hashmap. This way the function can locate an object and then use a structured attribute to get the attribute value.

See Also

Email Template Editor

Email Template Tab

Object Type Tab