Check a box from a Notification email

  • 0
  • 1
  • Question
  • Updated 10 months ago
  • Answered
We want to check a checkbox using a link disguised as a button in a notification email. Has anyone tried such an endeavor and had success? 

My brain says it's possible and easy so if you know something my brain doesn't let me know. 

Thanks in advance. 
Photo of Jim Harrison

Jim Harrison

  • 1,800 Points 1k badge 2x thumb

Posted 10 months ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 57,700 Points 50k badge 2x thumb
That is easy to do, I think, but the issue will be permissions and even if the user does have permissions they may not be logged into Quick Base.

You could have a userid with restricted permissions, but enough to check the checkbox and the button could authenticate with a userid and password and then redirect to check the checkbox and then it would need to do something like display the record.
Photo of Jim Harrison

Jim Harrison

  • 1,800 Points 1k badge 2x thumb
I'm getting closer.

<p>
<a href="https://<realm>/db/<dbid>?a=er&amp;r=&amp;[Record ID#]&amp;fid7=1">Click to Approve</a>
</p>
(Edited)
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 57,700 Points 50k badge 2x thumb
You can just use a formula URL field then.

The field will be called [Click to Approve]

But then what do you want to happen in terms of the user interface when the button is clicked.  Should it display the record?



var text URLONE = URLRoot() & "db/" & dbid()
& "?act=API_EditRecord&rid=" & [Record ID#]
& "&_fid_7=1";

var text URLTWO = URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [Record ID#]


$URLONE
& "&rdr=" & URLEncode($URLTWO)





 
Photo of Jim Harrison

Jim Harrison

  • 1,800 Points 1k badge 2x thumb
Nope, just check the box. Doesn't need to display anything. 

Thanks for the above, I was hoping to grab the dbid and realm data in the email but noticed it doesn't work that way. Making it into a field and then placing the field into the email makes more sense.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 57,700 Points 50k badge 2x thumb
So the issue will be that when the API run to check the box if you do not do something next it will likely spill some xml success message code back to the user. 

But I have not actually tested what happens when clicking from an email.
Photo of Jim Harrison

Jim Harrison

  • 1,800 Points 1k badge 2x thumb
Interesting behaviors: 
Here's what I have so far. I am trying it three different ways. I am testing both from the Preview window and via the email, responses are the same. 

<p>
<a href="https://<realm>/db/<dbid>?a=er&amp;r=&amp;[Record ID#]&amp;fid7=1">Click to Approve</a>
</br></br>
<a href="[Click to Approve]">Click to Approve</a>
</br></br>
Click Here: [Click to Approve]
</p>

The first one gets to the App, shows focus on the checkbox but doesn't check it.
<a href="https://<realm>/db/<dbid>?a=er&amp;r=&amp;[Record ID#]&amp;fid7=1">Click to Approve</a>

The second and third, give me a token error (An Application Token must be supplied.) when I click it using Preview or in Emails. 
var text URLONE = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]& "&_fid_7=1";
$URLONE

I removed the second variable in your recommendation because it was not encoding correctly see below. It's like Quick Base is ignoring the URLEncode function.
https://<realm>/db/<dbid>...
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 57,700 Points 50k badge 2x thumb
For now, turn off the need for application tokens.  Go to Application Properties and uncheck that box.

 or else if you want to use them you will need to create one and add in a line of code

& "&apptoken=xxxxxxxxxxxxxxxxxx"
Photo of Jim Harrison

Jim Harrison

  • 1,800 Points 1k badge 2x thumb
It's verking!
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 57,700 Points 50k badge 2x thumb
so what was the code for your final working button?
Photo of Jim Harrison

Jim Harrison

  • 1,800 Points 1k badge 2x thumb
Ah yes good point.
added a space between lines but each should be one line without newline or returns.

var text URLONE = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]& "&_fid_<Click to Approve fid>=1";

var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

$URLONE & "&rdr=" & URLEncode($URLTWO) & "&apptoken=<supersecrectspecialsauce>"

Use case:
We have a form that once status changes to Submitted starts a notification process. Several users must review this form and approve. The notifications trigger off check boxes changing and checked. The user receives enough information in the email to approve the notification. This way the approval process works quickly.

Releasing it to the masses - wish me luck. 

aaaand if the user is logged out of Quick Base it doesn't work. I am thinking about the least privileges user id above. Alternatively using Workato. Hmmmm managing a Role or managing a recipe...
(Edited)