Skip to main content
Question

Query the Response from an API_AddRecord formula text button

  • September 27, 2017
  • 0 replies
  • 55 views

Hello,

I have a formula text button which is an API_AddRecord and uses J-Growl notifcation to show the product has been added.  I made each product have a unique field so it can't be added twice.  The result is when the user clicks an already selected product it will still show the notification it has been added, but it will not add the product.  In the console I can see the reponseText showing the unique record error. 

Overall the system works great but I was hoping to enhance it by showing a J-Growl notification that says the product has already been added based on the response.  Basically how do I query the API response and make the notification dynamic based on the response?  Below is my current code within my formula text button.  The $ADDPROD variable is a simple API_AddRecord.  Let me know if this is possible within the formula-text field or if I have to create a code page for it.

var text URL = 
"javascript:" &
"console.log($.get('" & 
$ADDPROD & 
"',function(){" &
"$.jGrowl('"&[Product Name]&" Added', {life: 5000, theme: 'jGrowl-green'});" &
"}));" &
"void(0);";   

"<a href=\"" & $URL &"\"" & ">Add to Activity" &  "</a>"

Thanks!
This topic has been closed for replies.

  • Registered
  • September 27, 2017
First I wouldn't use the $.get inside console.log. I'd be willing to give you a hand if you're willing to do this in a .js custom page instead of a formula text .and then adding an invisible field to load the JS file known as the image onload technique. It's a pretty simple setup and can be found on the forum. If you add IOL and want help feel free to reach out. Chuck@Chuck.Support

  • Registered
  • September 27, 2017
You have to use script to process the response of an API method. Chuck is a Certified Image Onload QuickBase DeveloperTM so you are in good hands. We have other QuickBase certificfation programs available you may be interested in when you have more ambitious scripting requirements::
  • Certified Image Onload QuickBase Developer&trade;
  • Certified Branding Onload QuickBase DeveloperTM
  • Certified Service Worker QuickBase DeveloperTM
  • Certified Async/Await QuickBase DeveloperTM
  • Certified Observables QuickBase DeveloperTM