Forum Discussion

JohnLuoma's avatar
JohnLuoma
Qrew Member
4 years ago

Asset check-in logging

I am creating a mobile app that will allow a user to check in an asset. They will scan a barcode or type in an asset id in a a search box. That will bring up the record where there will be a "Check In" button. I want the button to create a new record in a Log table where a Date/Time field has a default of Now(). I want the button to save the record and return to the search dashboard. I am using the standard new record command button:

URLRoot() & "db/" & [_DBID_LOGS] & "?a=API_GenAddRecordForm&_fid_7=" & URLEncode ([Record ID#])& "&z=" & Rurl()

How do I get it to also save the record and return to the search form. Looking for the proper way to do it now that embedded JavaScript is not an option.

------------------------------
John Luoma
------------------------------

1 Reply

  • You'll have to use the actual API to generate the record. API_GenAddRecordForm is really just a way of pushing the user to the Add Record form and isn't meant to be used for automating the addition of records in the background. For this, you'll want to use API_AddRecord. Below is the code for a simple Add and Redirect:

    var text tk = "your app token";
    var text URL =  URLRoot() & "db/" &  & "?a=API_EditRecord&apptoken=" & $tk & "&rid=" & [Record ID#] &
        "&_FID_10=now"  & //this would be your Date/Time Field
        "&_FID_11="  & "Whatever value you want to put in Field 11"
        "&rdr=" ;
    var text Land = the URL where you want the user to land;
    
    "<a class='Vibrant Success' & href=" & 
    
       $url &
            
            URLEncode($land)
    
    
    & ">Check In</a>"​

    ------------------------------
    Blake Harrison
    bharrison@datablender.io
    DataBlender - Quickbase Solution Provider
    Atlanta GA
    404.800.1702 / http://datablender.io/
    ------------------------------