I guess the challenge with this is the dynamic redirect combined with getting the ID... each by itself isn't too much of a challenge given the resources at hand, but putting them together seems to be an issue. I'll give you the reason I'm doing it first
and then an update of where I am...
In my example above I used views of data because in my mind it was the easiest way to accomplish this. In reality I'm trying to determine when a specific condition exists so I can execute some other web services. I have two lists that store procedure documents,
one of which is "public" and the other is only open to a select group of people. The restricted list contains all procedures (archived and current) while the public one must contain all current ones. There is a one-to-many relationship the way the
lists are built, so one record may contain multiple attached procedures (hence the use of a list over a document library).
When one of the admins adds a new "Current" procedure (document state set by meta data on the record), I need to run a series of web service calls to accomplish the following tasks:
- Remove all records of that document ID in the public list
- Add the record to the public list
- Determine the attachments on the record, and replicate to the public list
Initially we wanted to do it in a workflow, but workflows don't support attachments (best I can figure out), so I'm resorting to web services which I have had luck with in the past.
I'm not too worried about the three bullets above. I don't think they're outside of the scope of SPServices/jQuery, and we're talking about an action that's going to execute maybe once a week by only one or two people so performance isn't really a worry.
I've tried using "redirectUrl: mySource" and defining mySource in PreSaveAction() but obviously that doesn't work as jQuery initializes before the variable has been populated. I don't have a problem doing the actions in the default newform.aspx,
the redirect was just so we had the ability to prompt the user that something was happening--maybe embedding in the form is a better direction.