Forum Discussion
ScottMarks
10 years agoQrew Member
Hello Evan!
In the detailed comments you say, "In the mean time, I need some help developing the "submit" button that automatically saves the record in addition to executing the URL that generates the notification email. "
I can help you with that!
First, we'll be snatching a snippet of code from haversineconsulting credits go to dandiebolt, and modifying it slightly. https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&r=ph&rl=cejw. We'll take his code and modify it to the following... (Don't forget to credit dandiebolt!)
< a class='Vibrant Success' {try{saveMenuOption.click()}catch(exception){saveButton.click()}};' href='YOUR QUICKBASE JAVASCRIPT PAGE' target='_blank'>Save...< /a>
(Remove the spaces before a and /a!). For a different color button, you can change the class from Vibrant Success to one any of the following: Vibrant Success (Green), Vibrant Primary (Blue), Vibrant Danger (Red), Vibrant Alert (Orange).
This will save your record, then point you to your javascript page where you can set up an email notification to a list of clients. You can query QB API for a list of emails, or have a pre-defined list.
One thing to note, is you will have to have a setTimeout or any other sleep function you choose for about half a second before any code executes on your javascript page or else the email will send at the same time as your save. (I assume you would like the record to be saved THEN send an email.)
Here's a reference on how to set up an email .js page: https://medium.com/@mariusc23/send-an-email-using-only-javascript-b53319616782. If that link doesn't do it for you, a quick google search should work.
Anyway, it is a little bit of a duct-tape method, but it does get the job done.
Regards,
Scott
In the detailed comments you say, "In the mean time, I need some help developing the "submit" button that automatically saves the record in addition to executing the URL that generates the notification email. "
I can help you with that!
First, we'll be snatching a snippet of code from haversineconsulting credits go to dandiebolt, and modifying it slightly. https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&r=ph&rl=cejw. We'll take his code and modify it to the following... (Don't forget to credit dandiebolt!)
< a class='Vibrant Success' {try{saveMenuOption.click()}catch(exception){saveButton.click()}};' href='YOUR QUICKBASE JAVASCRIPT PAGE' target='_blank'>Save...< /a>
(Remove the spaces before a and /a!). For a different color button, you can change the class from Vibrant Success to one any of the following: Vibrant Success (Green), Vibrant Primary (Blue), Vibrant Danger (Red), Vibrant Alert (Orange).
This will save your record, then point you to your javascript page where you can set up an email notification to a list of clients. You can query QB API for a list of emails, or have a pre-defined list.
One thing to note, is you will have to have a setTimeout or any other sleep function you choose for about half a second before any code executes on your javascript page or else the email will send at the same time as your save. (I assume you would like the record to be saved THEN send an email.)
Here's a reference on how to set up an email .js page: https://medium.com/@mariusc23/send-an-email-using-only-javascript-b53319616782. If that link doesn't do it for you, a quick google search should work.
Anyway, it is a little bit of a duct-tape method, but it does get the job done.
Regards,
Scott