Discussions

Expand all | Collapse all

API_Add Record >> Redirect to Thank You Page - Token Not Recognized

  • 1.  API_Add Record >> Redirect to Thank You Page - Token Not Recognized

    Posted 08-18-2021 12:03
    Hi everyone,

    I'm fairly new to QuickBase still; and am so appreciative the community here as reading through your discussions that are similar to my question helped me get this far.  So thank you!

    I'm still puzzled, however, on how to write a URL Formula to redirect to a Rich Text Thank You Page.  We have a lot of EOTI Surveys, and on pressing Submit, I want to make it clear the submission was received and thank the user for their time.

    My current code reads as:
    URLRoot() & "db/" & [_DBID_ITK_ATTENDEE_SURVEY] & "?a=API_AddRecord&AppToken="&[ItK-Token]&"=Approved"&"&rdr="&URLEncode(URLRoot() & "db/" & Dbid() & "?a=dbpage&pageID=2&ifv=1")

    But I still receive the error: 
    <qdbapi>
    <action>API_AddRecord</action>
    <errcode>24</errcode>
    <errtext>Invalid Application Token</errtext>
    <errdetail>An Application Token must be supplied.</errdetail>
    </qdbapi>

    I've verified that I DO have a functional Application Token; I applied to a Variable when the code wouldn't accept the token directly in it (it kept looking for a Text string?).

    I've been reading through this help guide: Configure URL Fields and this one: Using ""&z=""&Rurl() and rdr in formula URL fields
    I'm Totally puzzled why the sample formula provided for this purpose includes a rid and fid demarcation, when the goal is to submit a record and redirect to a Thank you Page.

    Can someone help me understand why my formula isn't working?  
    Is there a guide that helps break down the parts of formulas more clearly and provides a step-by-step roadmap?  

    Thank you so much,

    Jen


    ------------------------------
    Jennifer Juhasz
    ------------------------------


  • 2.  RE: API_Add Record >> Redirect to Thank You Page - Token Not Recognized

    Posted 08-18-2021 12:23
    I think that in fact you want to put up an Add Record form as opposed to actually adding a record.  if a human user is Saving a record on a manual form, then you do not need an App Token.

    Try this syntax

    URLRoot() & "db/" & [_DBID_ITK_ATTENDEE_SURVEY] & "?a=API_GenAddRecordForm"

    & "&NextURL=" &URLEncode(URLRoot() & "db/" & Dbid() & "?a=showpage&pageID=2&ifv=1")



    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: API_Add Record >> Redirect to Thank You Page - Token Not Recognized

    Posted 08-18-2021 12:33
    Hi Mark,

    Thank you so much for taking a look.  I love the simplicity of your suggestion, but it results in a pop-up that says "You must save this Response first".  

    Is there not a way to code a 'Submit' button that saves the record to the table and takes a person to a Thank You page?

    Thank you again!

    ------------------------------
    Jennifer Juhasz
    ------------------------------



  • 4.  RE: API_Add Record >> Redirect to Thank You Page - Token Not Recognized

    Posted 08-18-2021 12:50
    I think that we need to take a step back here.

    What are you trying to do?  Where is the user launching from?


    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 5.  RE: API_Add Record >> Redirect to Thank You Page - Token Not Recognized

    Posted 08-18-2021 12:57
    Hi Mark,

    The user is provided with this Survey via an email after an online community forum:
    https://familysmart.quickbase.com/db/brkb4ptab?a=GenNewRecord&ifv=1

    (I have several of these Surveys built for events we hold - but our team would like the Submit button to redirect to a 'Thank you' page)

    Thank you page for our Surveys App is: https://familysmart.quickbase.com/db/brfyiak3f?a=dbpage&pageID=2

    Our Orientation Coordinator said it was possible to build a button to do this, but we never reached a point where this was built or I was shown how to do it - so I've been trying to learn on my own (on the fly).

    Possible?  Seems like it should be a simple executable.

    ------------------------------
    Jennifer Juhasz
    ------------------------------



  • 6.  RE: API_Add Record >> Redirect to Thank You Page - Token Not Recognized

    Posted 08-18-2021 12:59
    Can you show me the code for your "submit" button?

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 7.  RE: API_Add Record >> Redirect to Thank You Page - Token Not Recognized

    Posted 08-18-2021 13:11
    Hi Again,

    I thought I had included that in the first post.  Apologies if it was missed - 

    My current attempt at the code is:
    // Declare Token
    var text Token ="d5g2j3tceucis9bqwtfbiba7vy6p";
    URLRoot() & "db/" & [_DBID_ITK_ATTENDEE_SURVEY] & "?a=API_AddRecord&AppToken="&[ItK-Token]&"=Approved"&"&rdr="&URLEncode(URLRoot() & "db/" & Dbid() & "?a=dbpage&pageID=2&ifv=1")

    What do you think?

    Note - I created an Application Token (that took me a bit to figure out,); and then when the code rejected using the Token characters directly (it kept asking me for a Text input) - I created a Variable called ItK and applied the Token code there.

    Thank you for your time!

    ------------------------------
    Jennifer Juhasz
    ------------------------------



  • 8.  RE: API_Add Record >> Redirect to Thank You Page - Token Not Recognized

    Posted 08-18-2021 13:24
    OK, I think that there is a simple answer.  If you make a button called Submit which goes to the Thank You page, then the record should auto save when you redirect away from the unsaved record. 

    URLRoot() & "db/" & AppID() &"?a=ShowPage&PageID=2&ifv=1"

    The table setting in Advanced Properties for the Surveys table should have this checked.

    Auto save when redirected away from the page.

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 9.  RE: API_Add Record >> Redirect to Thank You Page - Token Not Recognized

    Posted 08-18-2021 13:54
    Oh! That worked perfectly!  

    Thank you!!

    ------------------------------
    Jennifer Juhasz
    ------------------------------