JacobJacob
7 years agoQrew Cadet
Query the Response from an API_AddRecord formula text button
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!
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!