1

I'm working to set-up the PreSaveItem() on an edit form for a list such that it evaluates parameters from the query string, and some list fields to execute workflows based on various criteria.

Based on what I found from a previous question I was planning to migrate the workflow start code to the edit form and re-use the startWorkflow(itemID, subID) function. However when I add the script tag:

<script type="text/javascript" src="/_layouts/15/sp.runtime.js"></script>

Any attempt to save a list item from the edit form is met with:

Column '' does not exist. It may have been deleted by another user. {relative path to list}

This blocks saving entirely. When I comment out the tag, the error goes away, but the workflow start function throws an error when attempting to execute the workflow:

Error in {Workflow Name} workflow: Unexpected response from the server. The status code of the response is '0'. The status text of response is ''.

Despite this error, the workflow fires off and performs as expected. While I'm tempted to silence the error message and call this done, I'd rather have a real solution.

Any tips? The startWorkflow(itemID, subID) functions as expected on the display page.

Thanks.

5
  • Why do you need to trigger the workflow via code on the edit page, editing the item and saving it can trigger the workflow. Commented Feb 21, 2014 at 22:20
  • There are a few potential workflows to be triggered when an item is edited. Differentiating which to initiate on each edit may create unnecessary complexity. I suppose I could create a manager workflow to call other workflows based on criteria to avoid a single large tangled workflow. Commented Feb 22, 2014 at 0:15
  • 1
    That can all be handled in the workflow with their own If blocks. This can be done by using specific fields on your list to trigger certain workflows. A PreSaveAction could handle whether or not to set that value prior to saving the edit. Commented Feb 22, 2014 at 0:36
  • Sorry for the delayed response. I think I like this solution; the only possible caveat being having multiple instances of the same workflow on the same item. PreSaveAction sets a variable that the workflow on edit evaluates to execute a particular branch. During workflow execution the variable could be reset to a neutral state. Thank you. Commented Feb 25, 2014 at 23:15
  • List Workflow: Limited to running 1 instance of the workflow on an item at a time. Ran a test where a simple workflow sends me an email and then paused for 5 minutes. Subsequent edits did not trigger the workflow again, so having one workflow whose steps are determined by a PreSaveAction will not work in this instance. Commented Feb 27, 2014 at 21:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.