This project has moved and is read-only. For the latest updates, please go here.

Calling a function on commit

Sep 6, 2013 at 5:54 PM

Something that has had me scratching my head for a day or so; How would I do a callback when committing a data form?

Here's the scenario:
User edits a list item in a custom form. User clicks commit form action button which saves the record and then calls a function to fire a workflow.

I'm using SPServices to call the workflow as I don't want the initiation form displayed (I use the initiation parameters to determine what action a workflow should take (e.g. mark item as cancelled, postponed etc) which I pass in at runtime via JavaScript. my approach is to make the workflow act like a case statement as I can handle multiple scenarios in a single workflow.

It works beautifully where a user doesn't need to edit any data beforehand (e.g open an item then click postpone).

Any thoughts on the approach?


Sep 6, 2013 at 6:41 PM

I'm not sure if I understand where the gap is for you. Are you using a promise (jQuery .Deferred()) with the UpdateListItem call? If so, you can act after the item is written, even testing on some of the returned values.