Simple script to hide a Notification field based on another Field

Annette Kitzmil
Tera Guru

Hi All:

 

This is probably very simple, but I am jut not getting it right.  Basically, if the Account Type is Premium Savings as shown below, I don't want the "Requested Exception Term for Account field circled in red to show on the notification.  When the Account Type is not Premium Savings, I want it to show.  The script I have currently is shown below.  Can someone take a look and possibly reply back with the changes i need to make please?

 

AnnetteKitzmil_0-1710511225731.png

 

Current Script:

 

var reqTermForAccount = current.requested_exception_term_for_account;
    var remove = reqTermForAccount.remove("Requested Exception Term for Account:", "");
    var acctType = "Premium Savings";//if this acct type, we do NOT show the Req Exception Term for Acct
    if (acctType) {
        template.print('<b>Requested Exception Term for Account: </b> ' + remove.reqTermForAccount);
    }
    else;
 
 
Thanks,
9 REPLIES 9

Hi Swathi,

I am calling the mail script in my notification as shown below.  I know it is calling it based on the first part of the verbiage that is showing with the undefined shown above, or at least I would think it is calling it.

 

AnnetteKitzmil_0-1710515661865.png

I beleive that this script has the line you mentioned above commented out. i actually have the first two lines commented out on the script below.  Is that what you meant?

 

//var reqTermForAccount = current.requested_exception_term_for_account;
    //var remove = reqTermForAccount.remove("Requested Exception Term for Account:", "");
    var acctType = current.account_type;//
    if (acctType != "Premium Savings") {
        template.print('<p>Requested Exception Term for Account: </p> ' + current.requested_exception_term_for_account + 'months');
    }
    else;

 

Thanks,

@Annette Kitzmil yes you have to comment the starting 2 line and check backend value of Premium Savings is correct and remove else if this doesnt help try below

 

 

var acctType = current.getValue('account_type');//
    if (acctType != "Premium Savings") {
        template.print('<p>Requested Exception Term for Account: </p> ' +
current.getValue('requested_exception_term_for_account') + 'months');
    }

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

The final script that works looks like this, but you put me on the right track and got me here. thank you Swathi.

 

var reqTermForAccount = current.exception_for_term_account;
    var showTerm = reqTermForAccount;
    var acctType = current.account_type;
    if(acctType != "premium savings") {
        template.print('Requested Exception Term for Account: '  + showTerm + ' months');      
    }

@Annette Kitzmil , Great! 😊.Please accept the appropriate answer and close the thread so that it will be use full for future readers 

 

Thanks 

Swathi

Sumanth16
Kilo Patron

Hi @Annette Kitzmil ,

 

 

if (current.getValue('sccType') != 'Premium Savings') {//update if condition like this and update field  name from table
    template.print('Start: ' + current.u_glide_date_time_2 + '<br />');// update your template name
}

 

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda