Forum Discussion
You just need to add a redirect on the end of your URL. My cheat sheet below:
URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" & "&rid=" & [Record ID#] &
"&apptoken=xxxxxxxxx" &
"&_fid_59=0" & //this is setting a checkbox field, replace or add fields
"&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])) //Redirect anywhere, this is to the record that was edited, but you could use a dashboard
Remember, this will change slightly if you are trying to use the %%rid%% from earlier on this thread (ie, push this button while in add mode, before the RID has been established)
------------------------------
Mike Tamoush
------------------------------
Thanks Mike, I decided to just disable the apptoken which was the factor stopping me before, but using this I'm now having an issue where the rid is apparently missing even though I'm doing this in an edit form. Any thoughts?
------------------------------
Nolan Pilozo
------------------------------
- MikeTamoush10 months agoQrew Commander
Can you post your current code and the error you are receiving? Also, Mark taught me most of what I know, so he'll likely be able to sort this out if I swing and miss!
------------------------------
Mike Tamoush
------------------------------- NolanPilozo10 months agoQrew Member
My current code is
var text URL = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid=" & [Record ID#] & "_fid_20=" & URLEncode("success") & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]);
and the error I get is
<qdbapi><action>API_EditRecord</action><errcode>30</errcode><errtext>No such record</errtext><errdetail>Missing "rid" parameter.</errdetail></qdbapi>
------------------------------
Nolan Pilozo
------------------------------- MarkShnier__You10 months agoQrew Legend
The issue is that you want a button which will work in both ADD Mode and EDIT mode. But in ADD mode, the Record ID# does not yet exists. So you need to use a field type of Formula Rich Text (not formula URL) and have the button first save the record and then edit it.
var text RID = If([Record ID#]>0, ToText([Record ID#]), "%%rid%%");
var text URL = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&rid=" & $RID
& "_fid_20=" & URLEncode("success")
& "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=") & $RID;
"<a class='SaveBeforeNavigating' data-replaceRid=true style=\"text-decoration:none; background: #117a39; border-radius: 5px; color: #FFFFFF; display: inline-block; padding: 4px 4px 4px 4px; width:140px; text-align: center; text-shadow: none; border: 2px solid #0863f5; font-size: 12px \"href='"
& $URL
& "'>Set as Success</a>"
------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------