none
Creating a New List Item via Workflow, But if set to overwrite existing files, all fields are blank. RRS feed

  • Question

  • Hey guys,

    I have somewhat of a complex issue. I'm using a workflow to create a new word doc, who's fields are based off a list item in another list. 

    Anyway, this works great for new items, except that when I modify a list item, and rerun the workflow, it overwrites the word doc and makes all the fields blank. 

    I'm struggling to understand why that would be. Any ideas?  Please let me know if you need any additional info. 


    • Edited by Clayton Cobb Sunday, June 12, 2011 7:19 AM Removed lots of unnecessary white space
    • Moved by Clayton Cobb Thursday, June 16, 2011 4:37 AM SPD question (From:SharePoint 2010 - General Questions and Answers)
    Friday, June 10, 2011 4:09 PM

All replies

  • you will have to show your code to see what it is doing to resolve this.  with out seeing what the code is doing there is no way we can answer you question.
    de Nada
    Friday, June 10, 2011 4:44 PM
  • No problem, here is a screenshot: http://imageshack.us/photo/my-images/9/6102011100126am.png/

    Like I said, when I select "Overwrite" it just makes all of those fields blank in the word doc. As you can see my solution right now is to just delete any existing doc with the same name, but it isn't really ideal, as overwrite should just work!

    • Edited by Clayton Cobb Sunday, June 12, 2011 7:20 AM Again removed lots of white space
    Friday, June 10, 2011 5:02 PM
    1. That looks like a SharePoint Designer workflow.  Is it?  If so, then this is in the wrong forum.  There is an entire forum for SPD questions, and another forum for programming questions.  Neither type of question goes in General.
    2. I use workflows to create new docs but haven't seen this issue before.
    3. Why do you rerun the workflow when an item is modified?  Why would you overwrite the same doc? Isn't that faulty workflow logic?  Shouldn't the workflow only create new items?  Why would it be creating a new item when that item already exists?  What's the point?
    4. Your screenshot shows "append to filename," not "overwrite"
    5. I assume that if you assign a new filename every time, then it always works, right?  Why are you overwriting files with themselves?

    One possibility is that if you use this method to modify an existing file by overwriting it with itself and all the same metadata (not sure why you'd do this), then the new file has no metadata, so when you try to set the metadata of the new file to the old file, there is no old file to reference anymore.


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Sunday, June 12, 2011 7:24 AM
  • I wasn't aware of the Workflow forum, I will post this in there, thanks!

    The workflow simply generates a word doc based on a form. When the form has some part of its information changed, so should the word doc (hence it being overwritten)

    I know in the screenshot it was set to append, but that is only because the overwrite was not working correctly. 

     

    Thanks,

     

    John



    Wednesday, June 15, 2011 4:19 PM
  • No, don't ever re-post.  We move threads when they are in the wrong forum, but I wanted to clarify first.

    Ok, so you left out that whole part about creating the doc from a form AND that you are updating the doc when the form changes.  In this case, y ou should NOT be creating a new doc each time.  You should only create a new doc ONCE per form and then UPDATE the existing doc whenever it changes.  What you are doing is creating a new item every time, but you should be using Update List Item, and then update the metadata fields based on the InfoPath form fields.

    You definitely should not overwrite the doc each time - only update it.  That's definitely faulty workflow logic.


    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Thursday, June 16, 2011 4:37 AM
  • Oh ok, I won't repost then, thanks for clarifying. 

     

    Can you suggest how I would go about updating it? I wasn't aware I could do that via workflow...

     

    Thanks!


    Thursday, June 16, 2011 8:42 PM
  • By using "Update List Item" as I said.  However, are you actually changing the CONTENTS of the Word doc and not just the metadata of the Word doc when the form is updated?  How/why are you doing htat?  Either we are missing some more details, or you just need to use "Update List Item."
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Thursday, June 16, 2011 10:59 PM
  • The word doc has the columns inserted into it via document properties. I'm going to try updating the item, and hopefully that will also update the word doc. 

    We are doing this because we have a contract form that is filled out, and that generates the final word doc that we send to customers. (customers require the contracts to be in word)

    So anytime the contract form is changed, the word doc needs to change with it. I hope that helps. 

     

    Thanks

    Friday, June 17, 2011 2:05 PM
  • Any luck with this?  I am having the same problem.
    Wednesday, July 20, 2011 4:39 PM
  • Any luck with this?  I am having the same problem.

    It's not a problem - I explained what is happening.  To me, it's a design flaw of the solution, not a problem with SharePoint.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force
    Wednesday, July 20, 2011 10:00 PM
  • Clayton,

    Q1.Why do you rerun the workflow when an item is modified?  -- A. to refect the modifications... duh

    Q2. Why would you overwrite the same doc?-- A. its the same doc name/purpose, but it contains newly changed list data..

    Q3. Isn't that faulty workflow logic?  -- A. NO, i guess you fail to see the simplicity of the task..

    Q4. Shouldn't the workflow only create new items? -- A. then why even have the override option!!!! and no it would be able to more then 1 thing...

    Q5. Why would it be creating a new item when that item already exists?  -- A. see answer to question 2

    Q6.What's the point? -- A.. too many theoretical and practice scenarios to list off.

    what is the point of the Override file option then?

    I have data in a list, 100+ fields

    I have a workflow that when ran (currently set to run when a new item is created) creates a word doc containg data, (formatted for managers etc..)

    Ideally:

    Every time a new item is added to the list, or and old list item is changed, the Word Doc would remain up to date. I would want my List and libaray to have a 1 to 1 item count.... 1 document for each list item.

    The most straightforward way to do this would be to check the box that says "override existing files". everytime a new item is created or changed a fresh word doc is created and put into the library.. if a that word doc file already exist (it would be an old version so..) override it.

    that = me being done.

    but your telling me MS wants me to create a second workflow with 99% the same workflow?

    the only change being instead of using the "create list item" action use the "update list" action?

    and run one for new items and one for edit items?

    seems quite quite quite redundant to me.... and a bug.

    the field information should never be lost.. as its coming fresh from the fields not any meta data from the old word document....


    • Edited by olinga Monday, July 9, 2012 5:44 PM forgot something
    Monday, July 9, 2012 5:20 PM
  • By using "Update List Item" as I said.  However, are you actually changing the CONTENTS of the Word doc and not just the metadata of the Word doc when the form is updated?  How/why are you doing htat?  Either we are missing some more details, or you just need to use "Update List Item."
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force

     this is again how and why...

    http://blogs.technet.com/b/brenclarke/archive/2009/04/15/automatically-create-word-documents-which-include-list-fields.aspx

    Monday, July 9, 2012 5:52 PM
  • Any luck with this?  I am having the same problem.

    It's not a problem - I explained what is happening.  To me, it's a design flaw of the solution, not a problem with SharePoint.
    SharePoint Architect || Microsoft MVP || My Blog
    Planet Technologies || SharePoint Task Force

    you explain nothing and deture others from providing a solution..this is a problem and you are blind!!!
    Monday, July 9, 2012 5:55 PM
  • Agree, there are plenty of reasons to use the overwrite and it is not a design flaw. In my case I use it for policy repository and a approval workflow happens when a policy gets updated and I need it to update the actual repository with the new data. Update list would work fine and all but if the template ever gets updated the existing items will not ever update if the new fields gets filled in etc.

    This is where overwrite with version control would work great. However I have the same issue, it looks like on the version control that the action works backwards, it updates the list item then overwrites the document / data after the update occurs. You can see this based on the history 2 updates happen, one with the data and then another that is just blank.

    Going to look into using update if it exists and see if there is anyway to update the template file but I doubt it with SPD. This would of worked great if the order of the action was proper. Any of you guys ever find a solution since this is an old thread?

    Monday, July 9, 2012 10:52 PM
  • Agree, there are plenty of reasons to use the overwrite and it is not a design flaw. In my case I use it for policy repository and a approval workflow happens when a policy gets updated and I need it to update the actual repository with the new data. Update list would work fine and all but if the template ever gets updated the existing items will not ever update if the new fields gets filled in etc.

    This is where overwrite with version control would work great. However I have the same issue, it looks like on the version control that the action works backwards, it updates the list item then overwrites the document / data after the update occurs. You can see this based on the history 2 updates happen, one with the data and then another that is just blank.

    Going to look into using update if it exists and see if there is anyway to update the template file but I doubt it with SPD. This would of worked great if the order of the action was proper. Any of you guys ever find a solution since this is an old thread?

    Ok, so I found a work around for this by using a trick I used on another workflow I use for updating document names with ID's. Basically Use a Create List Item with the overwrite command to overwrite your template with the latest template file (if it updated), then stick a pause for 1 minute in the workflow. After that use an update list item and use the ID variable from the create new list item action and your good to go. There will be the delay waiting on your timer job, but this is better than nothing and mine will be going through an approval process so all the approved notification can go after the pause is finished anyway.

    If anyone has a bug report in or knows of a fix so it doesn't have to be rigged I'm all ears, but this work around works for me and maybe others out there with this issue.

    • Proposed as answer by kiwi_cam Wednesday, March 8, 2017 3:11 AM
    Monday, July 9, 2012 11:18 PM
  • Turismon, is it possible to share a screenshot of your workflow? 
    Monday, May 8, 2017 2:19 PM
  • made me laugh!

    Funny enough we are in 2019 - and that bug still exists!!!

    "Overwrite" just doesn't work...

    I've tried with "Pause" and "Update Item", but my workflow is failing at "Update Item" for some reason... And fields are left empty...

    Friday, June 14, 2019 1:08 PM
  • Seems the best solution so far in 2019! (facepalm)

    But for me "update list" doesn't work, workflow fails with error. Scratching my head as what would be the issue.

    Friday, June 14, 2019 1:09 PM