This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can't get the If statement to work in a notification.

Hello,

I'm trying to have my notification template use an if statement. What am I doing wrong? The code is reading the variable.

This is my test code:

The Platform is :$FIELDVALUE(Platform)

$IF(Platform, M8)

This is an M8 Install.

$ELSE()

This is not an M8 Install.

$ENDIF()

*****************************************************************************************************************************

Output is:

The Platform is:M8

This is not an M8 install.

'************************************************************************************************************************8

The output is incorrect as far as I'm concerned.

Is this something I need to do to make the the if statement work?

Regards,

WIll

  • 0 in reply to   

    This looks like a great solution to my problem. I've tried it but the code pushes out as text from the html template. Am I missing something? Do I have to push it out through a text filed like jraile showed to get the style code to render? (I have tried that and it is failing).

  • 0   in reply to 

    When you are editing an .htm email template, ensure that you are editing in Content Editing Mode of plain text:

    Weird, not sure why that pasted so small.

    Then in your template at the beginning, I would add the styles:

    $BEGINSUBJECT() $NOTIFICATION() $ENDSUBJECT()
    <style>
    .EmployeeOther, .OtherAE, .ContractorAE, .ClientAE, .VisitorAE, .PublicAE {display:none;}
    </style>

    <table....begin content>

    It should work in most emails. When I first tested this a few years ago Outlook was still using Word as it's rendering engine, so there was some anomalies. That should be fixed now.

  • 0 in reply to   

    EDIT:

    Another way to do this is to define Strings in the "String IDs" table (TS_STRINGIDENTIFIERS) that contain the content of the template, then reference those in the HTML template using the "$STRING()" template tag.

    The contents of the String ID "Value" field is treated as HTML.  I didn't experiment to see if template tags contained within the body of the String value would be expanded.  That would be cool if it worked.

    I tried using Application Variables and Form Localization Strings.  I was not able to find a Template Tag syntax that would work with either of those but, fortunately, the String IDs approach works.

    My justification for this approach was trying to avoid putting all that HTML in the database for every single record.  We have several Apps with tens of millions of primary table records, so having kbytes of HTML text on every item would not make our database and infrastructure people happy.