Discussions

 View Only
Expand all | Collapse all

Best way to trigger notification email

QuickBaseCoach Dev./Training

QuickBaseCoach Dev./Training10-26-2018 13:46

Brian Dunk

Brian Dunk10-26-2018 14:57

Brian Dunk

Brian Dunk10-26-2018 15:10

  • 1.  Best way to trigger notification email

    Posted 10-26-2018 12:49
    I have an application that has a parent child table relationship.  After the user sets up the Shipment (Parent) they will add Items (Child) to the shipment.  The amount of items can be different every time a Shipment is created.  When the user is done adding items to the shipment I want to send an email notification.  My question is what is the best way to trigger the notification when the user is finished adding items?  I do not want to send a notification every time an item is added and sending a notification when the Shipment is set up does not actually mean the shipment is ready for processing as the user needs to still add Items to the shipment.  Any suggestions is much appreciated.


  • 2.  RE: Best way to trigger notification email

    Posted 10-26-2018 12:52
    I suggest making a formula URL button to populate a field with the current date/time. to trigger the Notification based on that field changing.  The button would be on the parent record.  I can help you with the formula if you need that help.


  • 3.  RE: Best way to trigger notification email

    Posted 10-26-2018 12:57
    Ok, so how would that work?  The user clicks a button, the field is updated, and because the field is modified, the notification is sent?


  • 4.  RE: Best way to trigger notification email

    Posted 10-26-2018 13:12
    Yes can you send the formula to do that?  Thanks


  • 5.  RE: Best way to trigger notification email

    Posted 10-26-2018 13:25
    I have a checkbox field named Shipment_Complete.  Can that be used as the modified field?  If not the current date and time field would be fine.  What type of field would that be?


  • 6.  RE: Best way to trigger notification email

    Posted 10-26-2018 13:29
    var text URL = urlroot() & "db/" & dbid() & "?act=API_EditRecord"
    & "&apptoken=xxxxxxxxx"
    & "&_fid_xx=" ToText(now());


    "javascript:" &
    "$.get('" & 
    $URL & 
    "',function(){" &
    "location.reload(true);" &
    "});" 
    & "void(0);"

    // note, if you have application tokens enabled in the Advanced Properties setting for the app, you will need to include that apptoken line

    Replace xx with the field Id of a date time field that you will use on the form to show the users when the notification has been sent.


  • 7.  RE: Best way to trigger notification email

    Posted 10-26-2018 13:42
    Ok so I removed the apptoken line since I am not using apptokens.

    I created a "EmailSent" Date/time field.  ID = 57

    I also created "EmailButton" Formula URL field where I placed the code and got the following:

    0


    When saving I get the following error:



  • 8.  RE: Best way to trigger notification email

    Posted 10-26-2018 13:46
    fix this line to be

    & "&_fid_57=" & ToText(now());



  • 9.  RE: Best way to trigger notification email

    Posted 10-26-2018 14:10
    Sorry to be so needy...first time doing this.  Code seems fixed.

    I have the button (EmailButton) with the Code behind it and the EmailSent (FieldID=57) Date time field.  

    I have created a notification as follows:
    Notification When: a shipment is Modified and "Any of the following fields change with "EmailSent" checked.

    I click the button and nothing seemed to happen.

    EmailSent field still blank after clicking button.


  • 10.  RE: Best way to trigger notification email

    Posted 10-26-2018 14:39
    I would have a field for the user to mark as "Complete", when they know that there are no more items to be added or edited and it is final. Then have your email go out when a record is modified and that field is modified and after it is modified, it is "Complete".


  • 11.  RE: Best way to trigger notification email

    Posted 10-26-2018 14:41
    The API is failing but that javascript is hiding the error message.

    Copy the field as a test and just have this

    var text URL = urlroot() & "db/" & dbid() & "?act=API_EditRecord"
    & "&apptoken=xxxxxxxxx"
    & "&_fid_57=" & ToText(now());

    $URL


    Run that button and it will expose the error message.  I suspect that you have application tokens enabled.




  • 12.  RE: Best way to trigger notification email

    Posted 10-26-2018 14:42
    sorry, i meant this

    var text URL = urlroot() & "db/" & dbid() & "?act=API_EditRecord"

    & "&_fid_57=" & ToText(now());

    $URL


  • 13.  RE: Best way to trigger notification email

    Posted 10-26-2018 14:52
    Ok here is what I received:


    Require Application tokens check box under Security Options is unchecked.


  • 14.  RE: Best way to trigger notification email

    Posted 10-26-2018 14:57
    Yes I ran it without the apptoken line.


  • 15.  RE: Best way to trigger notification email

    Posted 10-26-2018 15:07
    what happened when you ran it without the javascript, like i suggested.


  • 16.  RE: Best way to trigger notification email

    Posted 10-26-2018 15:10
    Same error:



  • 17.  RE: Best way to trigger notification email

    Posted 10-26-2018 15:13
    OK, yes I left out the most important part of the formula, which record to edit!

    var text URL = urlroot() & "db/" & dbid() & "?act=API_EditRecord"
    & "&rid=" & [Record ID#]
    & "&_fid_xx=" & ToText(now());


    "javascript:" &
    "$.get('" & 
    $URL & 
    "',function(){" &
    "location.reload(true);" &
    "});" 
    & "void(0);"


  • 18.  RE: Best way to trigger notification email

    Posted 10-26-2018 15:20
    Still nothing happening.  EmailSent date/time field still blank. 

    Error with no Java:  






  • 19.  RE: Best way to trigger notification email

    Posted 10-26-2018 15:25
    That as a success message. The original button will now work if you add in that extra line like I suggested.


  • 20.  RE: Best way to trigger notification email

    Posted 10-26-2018 15:33
    Success!!!!!  Thanks so much for the help.