Save functionality without using Save button in toolbar? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Save functionality without using Save button in toolbar?

Last post 06-24-2020 02:14 PM by Hilary Stoupa. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-24-2020 06:17 AM

    Save functionality without using Save button in toolbar?

    Here's my situation: We have a form that's used by our whole organization. Tons of requests get submitted each year, so I have a workflow that's set to copy the forms to their respective "archive" libraries for each individual office once a request is marked as received. The reusable workflow on the archive libraries then deletes the matching request from the parent library.
    I've learned that apparently there's a need for offices to be able to edit the forms occasionally after they have been "archived". Right now the archives are set to read only for them, but not for me as an admin. So I tested this out and realized that if the form in an archive is resubmitted it will resubmit to the main library (because that's how the submit data connection is set) and then the workflow sees that it's been received and moves it again to the archive - and I end up with a second copy of the form in the archive with the name having the filename plus a new filename added to it like this:
    IL-N-2020-06-08T12_17-46(2020-06-16_10-16-51_9566).xml
    There are more than 100 separate offices, so it was annoying enough writing up the workflow conditions to route the forms to the appropriate archive libraries - I'm definitely not going to have more than 100 submit data connections within the form (I would think that would not be a good best practice). I could add a Save button to the toolbar which does indeed save the form to the location it's in without changing the filename - but if the Save button is in the toolbar then users may try to use it initially which then allows them to custom name their form which I do NOT want. And I could put a message on the form that warns them not to use the Save button until a specific situation arises, but plenty of people gloss over those kinds of warnings so there's no way that would not cause problems.
    I would be open to adding .js code to a button if something like that would work, but really I would prefer to use a web service to save the form that way - is something like that possible?
  • 06-24-2020 08:37 AM In reply to

    Re: Save functionality without using Save button in toolbar?

    Yuck. This is a tough one - we use our own InfoPath Forms Services replacement, FormsViewer, which allows us to change submit connection URLs, so we can dynamically set those based on where the file is opened. But without third party tools, I don't see a way to do this. You are right that you don't want 100 (or so) submit data connections, then the 100 or so rules to determine which to use. What version of SharePoint are you using? On-prem or online? I don't think there is going to be a way to do this with JavaScript unless the form is displayed in a web part.... And InfoPath out of the box will only perform Get operations with REST, so I don't think you'll be able to save the file via one of SharePoint's web services.... But I wonder - won't the workflow let you overwrite an existing file? Or couldn't it be changed to first check and see if a file already exists with the same name, delete it, and then replace it? I don't use SharePoint Designer Workflow much, so I'm not sure what the options are.
    Hilary Stoupa

  • 06-24-2020 01:17 PM In reply to

    Re: Save functionality without using Save button in toolbar?

    Thanks for your quick response as always, Hilary! I figured out a solution via the workflow as you suggested:

    Condition on the main library workflow says

    If Field1 equals X
    If Moved to Archive equals Yes, Delete item in Archive X
    then Copy item in Current Item to Archive X

    Tested it out on one specific archive and it works like a charm. Phew! This project is going to be the end of me!!
  • 06-24-2020 02:14 PM In reply to

    Re: Save functionality without using Save button in toolbar?

    Wonderful, glad you have it working!
    Hilary Stoupa

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.