none
Duplicate a form in InfoPath RRS feed

  • Question

  • Hi,

    I'm using InfoPath 2013 (in filler mode) on a SharePoint 2010 site. In a form,

    I've used an image button and associate rules to "reset" fields involved in this approval form.

    Then a connexion to SharePoint document Library is made to find the latest ID in the list.

    A concatenation is done with MAX(ID) to build a new numbered filename (ex. DOC00999)

    Finally, an other connexion is made to save the new form with this new name.

    This is working GREAT! File is saved in the right place, with it's new name. But form stay open! When I try to close the form with Application Quit button ("X" at top right), a message invite to save the source file with it's older name (???!!)

    Usually, when form is saved, a "success box" appear and all is closing when clicking its "OK" button.

    So, I've added these few VB lines to force the form to close.

    Dirty = false
    Me.close()
    As a result, form is closed, but InfoPath (filler) stay open (without any form displayed)

    So, I've try to add "Application.Quit()" to this code, without success (errors are displayed and InfoPath stay open!)

    Any suggestions?

    Thanks in advance!

    Regards,

    Jacques

    Monday, December 11, 2017 12:58 PM

Answers

  • Hi,

    I've finally found why my form has this behavior,

    Security seems to have been upgraded to higher level.

    So, now my form need Total trust to work as earlier.

    Thanks,

    Jacques

    • Marked as answer by MrMeteo Tuesday, December 19, 2017 7:02 PM
    Tuesday, December 19, 2017 7:01 PM

All replies

  • Hello,

    Please manually duplicate the form, save it and close. Would it work?

    If the issue only occurs when you create and save it programmatically, what code do you use? Could you please share detail repro steps and code here to help us reproduce the issue?

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, December 12, 2017 7:09 AM
    Moderator
  • Hi Celeste,

    I'm saving manually to an other filename (in SP 2010 document Library) without any problem.

    I'm using InfoPath 2013 (French) with a form in 2010 filer mode (originally created with InfoPath 2010).

    My button is an image button with Action set to "Rules and managed code".

    1 - Rules are resetting an already completed and approved form, like this:

    Approbe = ""
    ApprobeDate = ""
    Confirmation = false()

    2 - Prepare to save with a new name:

    Execute a data connexion against SharePoint 2010 Library to get only IDs

    Create a Number (to be a part of filename) with concat(substring("000000"; max(ID)+1)

    Save the form with a data connexion, with a new name created with an other concat("RF";Number)

    Then, new file is saved with proper new name (ex. RF000099.xml) 

    At that step, ALL IS GREAT! New form is duplicated with all the data inside (minus approval), with the right new filename, in the right SP Library.

    But the form stay open! If we try to force it to close with "X" (application Quit), form tell us to save the form with its original (older filename, prior to Duplicate).

    To correct this problem, I've tried to "clean" the Dirty form with (VB) code in the form :

    Dirty = False
    Me.Close()

    Form is closing.... but InfoPath stay open and empty!

    I've finally add this code to force IP to close, but errors are displayed instead.

    Application.Quit()

    This form is used since 2014 without problem, but earlier in 2017 this behavior appear.

    Thanks in advance!

    Regards,

    Jacques

     

    Wednesday, December 13, 2017 2:26 PM
  • Hello,

    Could you please share complete code you use to help us reproduce your issue?

    We are not familiar with InfoPath development and SharePoint. i do not find any useful documents online about the variables you are using in the rules. To create connection to SP library, should i follow How to: Create and Use a Data Connection Library?

    Since it works since 2014, i suggest you install all Office updates and you could also revert to earlier version to confirm if the issue is related to Office updates.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 14, 2017 7:36 AM
    Moderator
  • Hi,

    The variables (Approbe, ApprobeDate, etc) that I stated in prior post are part of my data structure (not system variables).

    Your link to data connections is great, but we are not using data connections saved on SharePoint. Data connections stays in the form itself. So, in section "To create a new data connection file in InfoPath" follow only steps 1 to 5.

    For updates, I'm working for goverment, so updates (and rollback) aren't available to me.

    Regards,

    Jacques

    Thursday, December 14, 2017 1:20 PM
  • Hello,

    I create a form and add two data connections. One of the data connections is used to retrieve data to get the ID. The other is used to submit the form to sharepoint library.

    Then I create a button, add a rule to run the following actions. Once I click the button, it could get the max number, create a new file named as max(ID)+1 in the SharePoint library and close this form. The application would also quit if there is no other form opened.

    Data connection to submit data:

    I do not write any code when designing and the code you are using would not be compiled in the FormCode.vb.  

    I suggest you share your template here. You may upload the file into OneDrive and share the link here.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, December 15, 2017 8:43 AM
    Moderator
  • Hi,

    I've finally found why my form has this behavior,

    Security seems to have been upgraded to higher level.

    So, now my form need Total trust to work as earlier.

    Thanks,

    Jacques

    • Marked as answer by MrMeteo Tuesday, December 19, 2017 7:02 PM
    Tuesday, December 19, 2017 7:01 PM