Updating QB field with from an javacript request

  • 0
  • 1
  • Question
  • Updated 1 month ago
  • In Progress
Hi, 

I need to edit an existing field with a jwt token from an external system.
To do this I have created a javascript calling the AUTH process to request the jwt token.


My request code looks like this: 

$.ajax({
           type: 'POST',
           url: "https://api.endpoint.url";,
           processData: true,
           data: {login: "username, password: "password"},
           dataType: "JSON",
           success: function (data) {
               processData(data);
           }
});
 
function processData(data){

var token = (data.sessionData);
console.log (token)

}


How can I save the variable "token" to a field in QB.
I need to recurrently update the same field with the token string as the token expires.

Hope anyone can help


Best regards

Photo of Shadi Hashem

Shadi Hashem

  • 192 Points 100 badge 2x thumb

Posted 2 months ago

  • 0
  • 1
Photo of Chayce Duncan

Chayce Duncan

  • 2,002 Points 2k badge 2x thumb
Are you doing this from a Quick Base code page or a button on a form? If your function for processData is successfully parsing the token out, then your last step is to just finish it off and do an API_EditRecord call back into Quick Base and update whatever field you want this token stored in. So inside of your function processData you could do a simple $.get request such as $.get('https://yourrealm.quickbase.com/db/dbid?a=API_editRecord&rid=your record id&_fid_1000=' + token); swapping out your actual realm / dbid / record id and fid components for the actual record you need to update


Chayce Duncan | Technical Lead
(720) 739-1406 | chayceduncan@quandarycg.com
Quandary Knowledge Base