Formula URL - save entry and redirect

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

Basically, my workflow goes like this

Stations > Timesheets > TimeEntries

From the Station page, users click "Add Timesheets" to add a related timesheet record.  Then from that page, I have a formula URL button that automatically creates several child records (TimeEntries) to that.  However, this button only works if the Timesheet record has been saved first.  If the record hasn't been saved, it simply redirects to the Timesheets form, but removes the parent info (making it very confusing for the end users)

What I'd like to do is have the button fire off a DoSaveAdd() call to save the record, then hit the formula URL to pre-populate the TimeEntry records, and finally redirect back to the edit page on the Timesheet, where we started.  

I've tried just adding "javascript:DoSaveAdd()" at the beginning of the URL field, but it ends up redirecting to the previous page (the "Stations" record page) and never adds the TimeEntry records.  I've also tried using "$('input[name=RedirectURL]').val" as per some posts I've seen on here, but it still seems to want to keep redirecting to the Station page, rather than to my API call to add the related records.

Does anyone have any insight on how I can make this work?

Photo of Andrew

Andrew

  • 40 Points

Posted 3 years ago

  • 0
  • 1
Photo of Tribs

Tribs

  • 20 Points
hi - did you find a solution for this. I have a similar requirement and is unable to find the right solution.
Photo of itsjustchuck

itsjustchuck, Champion

  • 80 Points 75 badge 2x thumb
I think Dans Save and Scooby Doo method is the best and I highly recommend doing that. but I'm trying to do it with a button and am not having much luck. The person I'm helping wants this functionality to work for either adding a new record or saving an existing record. But again, not tying it to the native save and only triggering on a special button click. If I figure out this undesirable workaround I'll post it to my question but if its your app. The best practice would be to do that technique with image onload. It makes it easier to code for it and its just an efficient way of inserting custom logic in your apps