Rich Text Formula Button which saves record and opens new window

  • 0
  • 1
  • Question
  • Updated 2 months ago
  • In Progress
I am trying to create a rich text formula which will save the record and continue working so i stay on the form but at the same time opens a new window with a specific form inside of it. This app is basically a medical records app and the button pops open the patients health history. The formula works great if the record is already saved, but when they are adding a new record and i try to utilize it the new pop up window comes back as nothing there.

I know this is because the record id doesnt exist yet, which is why i added in the "save and keep working" functionality. I believe the issue is my URL variable is at the top, so when the action runs, it's populating the URL for the popup window before the record actually saves. I can't figure out how to grab the record id AFTER the record saves.

here is my current formula, any assistance would be so great! i've been working at this for 10+ hours and just cant seem to figure out a solution.

var text URLone=URLRoot() & "db/" & Dbid()  & "?a=dr&dfid=11&rid=" & [Record ID#]&"&ifv=10";
"<a class='Vibrant Success' & onclick=\"$('#footerSaveAndKeepWorkingMenuOption').click();var a=window.open('"&$URLOne&"', 'newwindow', 'width=400,height=800');\" >Patient Health History</a>"


thanks so much!
Photo of Conner

Conner

  • 40 Points
  • stuck

Posted 3 months ago

  • 0
  • 1
Hi Conner, 

Have you found a solution? I'm a little confused by what you're trying to accomplish.

It looks like you want to open the same record only on another form in a separate window.

So essentially you'd be editing the same record on two different windows?

Would it be easier to create a section on the form with the info from the second form and show/hide it using a form rule and a checkbox (or button controlling a checkbox)?

The only other option I see is to have two 'versions' of the button. When no ID exists it will display "Save to View Patient History" which saves the record, then once an ID exists the button will display "Show Patient History" and will open the form in another window as intended.

var text SAVE =
"<a class='Vibrant Success' & onclick=\"$('#footerSaveAndKeepWorkingMenuOption').click();\" >Save to View Patient Health History</a>";

var text URL = URLRoot() & "db/" & Dbid()  & "?a=dr&dfid=11&rid=" & [Record ID#]&"&ifv=10";

var text OPEN= "<a class='Vibrant Success' & onclick=\"$('#footerSaveAndKeepWorkingMenuOption').click();var a=window.open('"&$URL&"', 'newwindow', 'width=400,height=800');\" >Patient Health History</a>";

If(IsNull([Record ID#]),$SAVE,$OPEN)


-Sharon