Discussions

 View Only
  • 1.  URL button change status

    Posted 07-26-2018 19:24
    I've created a buttong to change my status to complete.  What am have I done wrong?

    I'm getting this error using this:
     

    var text URLONE = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" &[Status]

    & "&_fid_12=" & URLEncode("Completed"); 

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

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


    This is the Error: 

    This XML file does not appear to have any style information associated with it. The document tree is shown below.

    <qdbapi>
    <action>API_EditRecord</action>
    <errcode>24</errcode>
    <errtext>Invalid Application Token</errtext>
    <errdetail>An Application Token must be supplied.</errdetail>
    </qdbapi>


  • 2.  RE: URL button change status

    Posted 07-26-2018 23:24
    There are two separate issues.

    If you have chosen to require Application Tokens, that is a setting in the Advanced properties settings for the app.  I suggest just disabling the need for them by unchecking boxing that requirement.

    If you read up on the Help text for application tokens  and decide that do want to use them, then you will need to add a line of code
    & "&apptoken=xxxxxxxxxx"

    For you actual code, you need to specify the Record ID# that you want to edit and display.


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

    & "&_fid_12=" & URLEncode("Completed"); 

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

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




  • 3.  RE: URL button change status

    Posted 07-27-2018 14:59
    Thanks so much that did it! 


  • 4.  RE: URL button change status

    Posted 07-27-2018 15:02
    actually one more question:

    I've added he button to a report as well.  seems like when you click the button on the report it the page directs you to the specific record.  Is there anyway for it to just stay on the report and not direct you to the into that specific record?


  • 5.  RE: URL button change status

    Posted 07-27-2018 16:07
    try this

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

    & "&_fid_12=" & URLEncode("Completed"); 



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


     note that I renamed that first formula variable.  We no longer use the second formula variable.


  • 6.  RE: URL button change status

    Posted 07-27-2018 16:44
    This is fantastic - thanks so much for your help, works great.


  • 7.  RE: URL button change status

    Posted 07-30-2018 16:52
    I've now revised this to update a field with the User ID of the individual that pushes the button and it seems to be working just fine with the below.  However, was wondering if anybody had any suggestions to change this us so that it only displays the user name.  Currently is showing their email address:

    var text URL = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#]

    & "&_fid_18=" & URLEncode([Last Modified By]);



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


  • 8.  RE: URL button change status

    Posted 07-30-2018 17:02
    There is a function called

    UserToName([my user field])

    Or you can also change the field properties of the user field to display the full name


  • 9.  RE: URL button change status

    Posted 07-30-2018 20:19
    thank you!