Expand all | Collapse all

JavaScript in a notification email?

  • 1.  JavaScript in a notification email?

    Posted 12-17-2019 05:59
    Edited by Inas Zadi 12-17-2019 06:01

    I'm using html in a notification email for my app, and I only want to display certain fields depending on their value.

    Users can either select an item from a drop-down, or select the "Other..." option within that drop-down. In the case of the latter, another field shows, allowing them to type in their "other" selection. (I didn't allow the drop-down to have items added to it by the user on purpose because I don't want their additions to be kept in the list in future record creation forms).

    With this, I want to have an email sent including the user's selection. So if the drop-down field has the selection "Other...", show the value in the other field, if not, show the value in the drop-down field.
    I tried putting the script directly where I want the text to go, this wasn't working, so I've just put a function at the top of the email and called it where I want the text to go. Using the field names in square brackets didn't seem to work either, so I've assigned them to variables and compared them that way (if(var=="Other..."){othervar;}else{var;}).
    I've written some similar script in a text file to check that it actually worked in theory with success, so I'm not sure why it isn't working in the email. It recognises the script tag I assume since the text isn't being shown in the email, so now I'm wondering if it can actually understand the contained JS or just the tags and ignores what's inside them? If not, is there another way I could go about this logic?

    tl;dr Can I use JS in QB notification emails? If not, can I selectively display field contents depending on other fields' contents?

    Thanks in advance :)

    Inas Zadi

    Edit: typo

  • 2.  RE: JavaScript in a notification email?

    Posted 12-17-2019 07:26
    I have no idea whether you can use JavaScript in an email notification.   So why not just keep it simple and have a formula field in your native QuickBase app calculate exactly what you want to show on the email notification and then put that field in a notification.

    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach

  • 3.  RE: JavaScript in a notification email?

    Posted 12-19-2019 05:12
    Ahh yes thanks, I didn't think of this. Just made one and it works well :)

    Inas Zadi