Forum Discussion

LawrenceClink's avatar
LawrenceClink
Qrew Cadet
7 years ago

How do you create an approval button within Email Notifications?

I setup the following in a formula URL field:

URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=<App Token>&_fid_224=Approved&rid=" & [Record ID#]

When it runs it gives me a link.
My users are asking for a html button.
Is this possible?

The other issue is that when submitting this link the system responds with a XML response.
I'd really like to give them a human readable text response.
Any ideas on this?

13 Replies

  • This syntax will probably work

    var bool NewToggle = not [Completed?];

    var text Update = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]
    & "&_fid_6=" & $NewToggle;

    var text Words = [Account Name];

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

    "
  • Thank you for the quick response.
    I believe your answer assumes a level of understanding that I do not have.
    I assume you are answering the part of my question to do with the XML response.
    I'm not quite sure what to do with the code you sent.
    You are referencing a fid of 6 (a boolean) which I assume I must modify to fit what I have in my table.
    I can create a new field type boolean if needed.

    Here's what I have:

    Table: Projects

    Field 224: Project Approval
    Type: text

    Field 225: Project Approval Button
    Type: Formula - URL
    Formula: URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=<App Token>&_fid_224=Approved&rid=" & [Record ID#]

    Notification: Project Completion Approval
    Condition: Sent wherever field "Status" changes to "Completed"
    Type: Custom Message
    Custom Message:

    Hello User,<br>
    Please approve the project [Project Name] using the below approval link.<br><br>

    [Project Approval Button]
    <br><br>
    Thank you for your attention,<br><br>
    MEDA QuickBase Administration


    I have 2 issues.

    1. Email is sent with a link (it works in that it updates the Project Approval with "Approved").
       Need to modify to send with a button as requested from the users.

    2. Once the link is submitted a browser session is started with a XML response.
       Need to provide a human readable response. These are business users and would not understand XML.

    Please let me know if any further information is needed.

    Thanks.
     

  • Try making a formula URL field and puttng it in your email notification.

    var text URLONE = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&apptoken=<App Token>&_fid_224=Approved&rid=" & [Record ID#];

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

    $URLONE
    & "&rdr=" & URLEncode($URLTWO)
  • Use the information below to put a link into a Notification email.

    This works on a PC or Mobile device. It also works if a user is logged in or not.


    The link is Used to respond to a Notification by changing a status, checking a checkbox, or other interactions that require a response. The example below clicks a checkbox.

     

    The link goes into a text field on the table:

    var text URLONE = URLRoot()& "db/" & Dbid()& "?act=API_EditRecord&rid="& [Record ID#]& "&_fid_<field ID>=1"& "&apptoken=<apptoken>"& "&usertoken=<usertoken>";

    var text URLTWO = URLRoot();

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

     

    Then the field is added to a custom email Notification:

    <a href="[Click to Approve]">Click to Approve</a>

     

    Improvements:

    Once the User clicks the link, the browser opens and takes the user to the QB login page. We would like to remove this unnecessary step. QB requires the User login to the App and load the page.

    To make the link into a button you must use the img tag. https://www.w3schools.com/css/css3_buttons.asp Use this tutorial to learn how to do this.

    Your button image can be one of the images stored here: https://login.quickbase.com/db/bcgnn27bx?a=q&qid=1000039
    • CharlieMurawski's avatar
      CharlieMurawski
      Qrew Cadet
      I would heavily suggest against exposing a user token in an email notification for several reasons. You are essentially handing the person the email goes to your keys to the kingdom. Sure, you can limit it to be 'safer' but this exposes a potential security hole and could result in your data, app configuration, etc.. being compromised.
  • So then how do you get the notification to turn the {<a href="[Click to Approve]">Click to Approve</a>} into a button?
    • JimHarrison's avatar
      JimHarrison
      Qrew Champion
      Funny, I thought about it this morning and realized that without an attachment the img tag appears as html text.

      Unless someone else has ideas, this looks like a UserVoice ticket and we gather a mob to vote it into reality. 
    • JimHarrison's avatar
      JimHarrison
      Qrew Champion
      Lisa, can you tell me what happens if the user has an account with Quickbase? While this video describes if the user doesn't have a quickbase account, we are interested in using this for both quickbase users and non-quickbase users. Can you speak from experience  before going through the trouble of building? 

      Thanks
    • LisaSell1's avatar
      LisaSell1
      Qrew Trainee
      Unfortunately we only used this button in an email feature once, and it was for the Everyone on the Internet role. Sorry I can't be of more help, but there seem to be more related conversations here in the forum - I'm sure someone has done this
    • NicoleCicala's avatar
      NicoleCicala
      Qrew Member
      I followed this and when sent to an external user cannot get the html page to load.  Its saying that we need to log in.  Did you experience the same issue?
  • That really helped.

    It gives me the code I needed for the button I was looking for.

    Thanks so much!

  • 100% Agreed Lawrence, it is working for me as well.  I am just stuck on the login page now, and need to figure out how to redirect to the exact table, as the user is an existing Quickbase User.