Calling a script with parameter in body of an email template

Hello,

In the out-of-the-box email templates there are examples how to call a script without parameters from the body of an email template, for example $Script(VI_GetRichMailSignature_Company)$.

I have tried multiple permutations to make calling a script with parameters work, but did not succeed. I searched the documentation but could not find any clue.

Has anyone of you found out how to call a script with parameters from an email template, or is this just not supported?

Thank you in advance.

Regards,

Mrs. Wilke Jansoone

  • Which version of OneIM are you using?

    Since 8.1.1 it is possible to call a script with one optional String parameter.

    In mail templates, any parameters can be used when calling a script.

    • Syntax: $SCRIPT(ScriptName, "Options")$

    The Options parameter is optional and is passed as a string. Custom parameters can be coded in any way in this string but need to be handled in the script. Quotes ("") are masked by doubling. In the script, the parameter is passed as the second parameter after the base object. The base object can now be either IEntity or ISingleDbObject.

  • Hello Markus,

    We are using version 8.2.1.

    Apologies for my late response. I needed some time to test a couple of things out. So thank you for your tip, it indeed resolves my issue. There is however an additional complexity in that the options argument needs to be composed in the mail template body. A string coming from the process that triggered the mail template needs to be concatenated with a fixed value. e.g. "guid from process" + "| nl-BE". The concatenation needs to happen in the mail template as is linked to the specific language version of the template. It seems that in the options parameter I cannot just use the string concatenation operator. Like $script(scriptname, $PC(guid from process)$ + "|nl-BE")$. I also tried string.format but did not work either.

    Am I expecting too much?

    As a side question, is the information you sent me to be found somewhere publicly? I would feel a bit annoyed if it was indeed and I bothered others with something that is publicly available.

    Thank you in advance.

    Kind regards,

    Mrs. Wilke Jansoone

  • Hi Wilke,

    I have copied the explanation from the official OneIM 8.1.1 release notes document.

    And yes, the $Script(<scriptname>, "options")$ - Notation is limited in its functionality in its current state and is meant to ease the usage of format strings for column-values of the base object of the mail template.

    e.g. You could write a script "CCC_FormatMyProperties" that decodes the options string as "<property name>|<format string>", uses <property name> to fetch a value from the first IEntity parameter, and uses <format string> to format the value into a custom string.

    Sample usage in mail template:

    early right parenthesis:
    $Script(CCC_FormatEntityValue, "InternalName|({0})")$
    
    dollar-sign in payload:
    $Script(CCC_FormatEntityValue, "EntryDate|${0,40:f}")$
    
    double quotes in payload:
    $Script(CCC_FormatEntityValue, "CentralAccount|""{0,40}""")$

    The output as target format txt using Catalan - Catalan [ca-ES] as culture:

    early right parenthesis:
    (Testuser, Holger)
    
    dollar-sign in payload:
    $       dimecres, 30 d’agost de 2017 0:00
    
    double quotes in payload:
    "                                 HOLGERT"


  • In addition, the documentation of 8.2.1 describes the $-Script features ("options" and :HTML) which both are part of the product in 8.1.1+ as well.

    https://support.oneidentity.com/technical-documents/identity-manager/8.2.1/operational-guide/13#TOPIC-1800695

  • Hello Markus,

    Indeed it is well documented. My apologies. Thank you for the examples, this is what I had also tested. But unfortunately I cannot retrieve the information from the baseobject. I need to send a mail with the previous and the current value of a property the baseobject. This information, while available in the process that captures the change, is not available in the mail template. So I have created two parameters containing the old and current value and having them passed to the mail template. So the options parameter is actually a concatenation of a variable ($PC(...)$) and a string literal. As you say the current functionality of the $script function is somewhat limited. What I will do is create a variation of the function for each of the string literals so that I don't need to pass the value explicitly.

    Again thank you for your assistance.

    Regards,

    Wilke