Forum Discussion

StacySeapy's avatar
StacySeapy
Qrew Member
4 years ago

Using the RunSaveRefresh Code Page Exampls from "Add Record" (Record doesn't exist yet)

I have successfully integrated buttons using the new Code Pages Sample App and it works great IF the record already exists - Thank you to anyone who worked to create it! 

What I am running into is that when I click the button from the "Add Record" view (ie. the record doesn't exist yet) I always get redirected back to a blank "Add Record" view again instead of the newly created record I clicked the button from. 

Here's an example of the code: 
var text Token ="TOKEN";

var bool NewValue = not [VALUE];


var text URL = URLRoot() & "db/" & Dbid() & "?a=API_EditRecord&apptoken="& $Token &"&rid="& [Record ID#] & "&_fid_113=" & URLEncode($NewValue) &"&rdr="&URLEncode(URLRoot() & "db/" & Dbid() & "?a=er&rid="&[Record ID#]&"&z=" & Rurl());

URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=16" // Open code page 16 (15 seconds)
& "&url=" & URLEncode($URL) // Pass in the URL to execute


I've tried a variety of combos of the ending of the url, included the new doredirect from this blog post to try to get it back to the original (newly created) record, but I also noticed that the fid_113 is also not changing when this button is clicked which makes me wonder if I should be using a different API call since the record doesn't exist yet? 

I basically am looking for the functionality of the former super simple "Save & Keep Working" javascript button that worked by saving the existing record (whether already it already exists or not), pausing, and then refreshing/returning to the newly created record (doesn't really even need to edit any field as I have a pipeline that will run when the record is added OR a field changes). 

I just want to make sure that a pipeline has a chance to run before the user continues filling out the remainder of the form.

Does anyone have any advice or examples of how to run the RunPauseRedirect code page and then return to the newly created record without using javascript outside of a code page? 

Thank you!

------------------------------
Stacy
------------------------------
No RepliesBe the first to reply