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

Parents
  • 0
    $IF(Platform, M8)

    I'm not familiar with that syntax for the "$IF" tag.  Which version of SBM is that? Can you point me to a user guide??

  • 0 in reply to 

    https://docs.microfocus.com/doc/Solutions_Business_Manager/12.1/ttwa_notification_tags   We are on version 12.1. This is the first time I've attempted the if.

  • 0   in reply to 

    In addition to what  has suggested, I've used the html capabilities of email to show/hide based on a field value. It doesn't work in all scenarios as CSS selectors are specific, but it might help.

    First, I added a style section to the email:

    <style>
    .EmployeeOther, .ContractorAE, .ClientAE, .VisitorAE, .PublicAE {display:none;}
    </style>

    Then added the classes to the particular sections that I wanted to show or hide:

    <span class="$FIELDVALUE(CATEGORY)AE"><b>Employee</b>: $FIELDVALUE(EMPLOYEE_AFFECTED) </span>
    <span class="$FIELDVALUE(CATEGORY)Other"><b>Name</b>: $FIELDVALUE(FIRST_NAME) $FIELDVALUE(LAST_NAME) </span>

    In this case, it shows the first line if category is employee, or it shows the second line for all other categories.

    You could probably do the following too, which would be close to an if statement, though I haven't tested this:

    <style>
    .hideInitial {display:none;}
    .$FIELDVALUE(Platform)show {display: block}
    </style>

    <div class = "hideInitial M3show">Show for M3</div>
    <div class = "hideInitial M8show">Show for M8</div>

    In this case, it hides everything, and then shows the ones based on the platform.

Reply
  • 0   in reply to 

    In addition to what  has suggested, I've used the html capabilities of email to show/hide based on a field value. It doesn't work in all scenarios as CSS selectors are specific, but it might help.

    First, I added a style section to the email:

    <style>
    .EmployeeOther, .ContractorAE, .ClientAE, .VisitorAE, .PublicAE {display:none;}
    </style>

    Then added the classes to the particular sections that I wanted to show or hide:

    <span class="$FIELDVALUE(CATEGORY)AE"><b>Employee</b>: $FIELDVALUE(EMPLOYEE_AFFECTED) </span>
    <span class="$FIELDVALUE(CATEGORY)Other"><b>Name</b>: $FIELDVALUE(FIRST_NAME) $FIELDVALUE(LAST_NAME) </span>

    In this case, it shows the first line if category is employee, or it shows the second line for all other categories.

    You could probably do the following too, which would be close to an if statement, though I haven't tested this:

    <style>
    .hideInitial {display:none;}
    .$FIELDVALUE(Platform)show {display: block}
    </style>

    <div class = "hideInitial M3show">Show for M3</div>
    <div class = "hideInitial M8show">Show for M8</div>

    In this case, it hides everything, and then shows the ones based on the platform.

Children