Forum Discussion
- AustinKQrew CommanderWhat do you mean by "trigger an API that will edit the record"? What are you trying to do when you edit the record? Can an automation work for you? It could fire when a record is saved or other types of triggers and do pretty much whatever you want with the record.
- AdamKeever1Qrew CommanderCheck out the magic buttons app in the exchange:
https://magna-5325.quickbase.com/db/main?a=AppDetail&ID=2660&app_name=Magic%20Buttons%20-%20Having%20fun%20with%20formula%20...
There are many examples of using the API to edit records. Here is an example of editing a record after a prior action from the Magic Buttons app; Check/Uncheck a checkbox then edit record:
If([Checkbox] = false,
"<a class='Vibrant Primary' style=\"width:310px; text-align: center;\" href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_101=1&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=er&rid=" & [Record ID#]) & "'>5B. Check a checkbox then edit record</a>",
"<a class='Vibrant Primary' style=\"width:310px; text-align: center;\" href='" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "&apptoken=d9eascudwjxs2sesxkjccwgtq9r&_fid_101=0&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=er&rid=" & [Record ID#]) & "'>5B. Uncheck a checkbox then edit record</a>"
)
// Press the button and this changes the "Checkbox" to checked and returns to edit record mode
// Press it again and this changes the "Checkbox" to unchecked and returns to edit record mode
// In this variation you can actually change the button label for each and it will reflect in the button - FrancescoSpiga1Qrew CadetAustinK, that would work but then I'll have to refresh the page to see the updated record - the automation lags compared to APIs (not a big deal anyway, this could work)
Adam Keever, Thanks for the suggestion. I'll check out the magic buttons and see if I can make it work the way I want.
My problem is that the record has not been saved yet... I want to save the record and then trigger the API or automation and display the updated record... - AdamKeever1Qrew CommanderDepending on the specifics of what you want to accomplish, you may be able to use the Save&Keep Working native button and use a dynamic form rule to change a field when the date created field is no longer blank.
I used this technique to hide a section of a form until the record was created, then once the record has a date created, then a dynamic form rule shows the additional sections. The bad part was that after save, the form opens in edit back at the top of the form, so I added a button at the top of the form to jump back down to the end of the section they just finished. - FrancescoSpiga1Qrew CadetI still have the issue of saving the records once the form rule gets triggered.
I am going with the automation for right now... I'll keep messing with the rich text field... I'll post something If I can get it right. - AdamKeever1Qrew CommanderTake a look at this post. You might be use able to Mark or Sharon's techniques for what you are trying to do (toward the bottom of the post).
https://community.quickbase.com/quickbase/topics/formula-url-button-save-and-redirect - FrancescoSpiga1Qrew CadetThat actually helped! Much appreciated ;)
- FrancescoSpiga1Qrew CadetFor the records, I ended up using the below:
var text url = "javascript:DoSaveAdd()";
"javascript:" & "$.get('" & $url & "',function(){" & "location.reload();" & "});" & "void(0);"
1. I change one of the fields with a form rule (Status = NEW to PENDING)
2. I post a child record with automation (who submitted the request and when)
3. Page refreshes and shows the child record (JS location.reload)
Table Advance Settings -
Make sure to check the option : "Save parent record automatically when a child record is created."
one click. mission accomplished!
Thank Adam!- AdamKeever1Qrew CommanderCongratulations! Way to stick with it and thanks for posting your final solution Francesco.