Codeless remove form from library - InfoPath Dev
in

InfoPath Dev

Codeless remove form from library

Last post 06-10-2013 03:49 PM by Jim Cantwell. 13 replies.
Page 1 of 1 (14 items)
Sort Posts: Previous Next
  • 05-22-2013 12:34 PM

    • TomRenfro
    • Top 75 Contributor
      Male
    • Joined on 09-29-2011
    • Oklahoma City, OK
    • Posts 134

    Codeless remove form from library

     I'm not sure if this is where this question goes, but doe qRules support a command that removes a form from a SharePoint form library?  I want to remove the original form from the library it was initiated from and publish the same form to a completed library.  I'm using a workflow and approval step that when processing is finished, the current status is marked Completed.  I've got the rules successfully saving the form to the correct library, but don't see anything that removes the original.

    Thanks.

  • 05-31-2013 08:29 AM In reply to

    • TomRenfro
    • Top 75 Contributor
      Male
    • Joined on 09-29-2011
    • Oklahoma City, OK
    • Posts 134

    Re: Codeless remove form from library

     I asked this question last week, still no reply.  Am I assuming it can't be done?  Can it be accomplished with SharePoint Designer workflow?

     Please help.

  • 05-31-2013 08:39 AM In reply to

    Re: Codeless remove form from library

     I wonder if the DeleteFromSharePoint command would work on a form library - can you give that a try?

    Hilary Stoupa

  • 05-31-2013 08:50 AM In reply to

    • TomRenfro
    • Top 75 Contributor
      Male
    • Joined on 09-29-2011
    • Oklahoma City, OK
    • Posts 134

    Re: Codeless remove form from library

     Is that a qRules command or SP designer command?

    And thanks for the reply.

     Never mind, it's qRules.  I'll give it a try and report back.

  • 05-31-2013 08:52 AM In reply to

    Re: Codeless remove form from library

     That is a qRules Command. I believe you can also delete items via workflow.

    Hilary Stoupa

  • 05-31-2013 11:59 AM In reply to

    • TomRenfro
    • Top 75 Contributor
      Male
    • Joined on 09-29-2011
    • Oklahoma City, OK
    • Posts 134

    Re: Codeless remove form from library

     OK, I'm getting an error when I try to use the command, and I'm sure it's because I'm not declaring the way it should be. 

    I'm using the following expression when setting a value in rules, specifically the value of Command under the QdabraRules node:

    DeleteFromSharePoint /url="https://forms.corp.integris-health.com/eForms/Staging/_layouts/FormServer.aspx?XmlLocation=/eForms/Staging/Submitted/"& ../@my:Key&".xml

    Not sure how to construct the URL with a variable pointing to the actual form name, as Key is the field attribute that stores the unique name of the form.

  • 05-31-2013 12:02 PM In reply to

    Re: Codeless remove form from library

     You should set the command to a formula (click the fx) and use a concat formula:

    concat("DeleteFromSharePoint /url=https://forms.corp.integris-health.com/eForms/Staging/_layouts/FormServer.aspx?XmlLocation=/eForms/Staging/Submitted/, ../@my:Key, ".xml")

    Hilary Stoupa

  • 06-03-2013 11:23 AM In reply to

    • TomRenfro
    • Top 75 Contributor
      Male
    • Joined on 09-29-2011
    • Oklahoma City, OK
    • Posts 134

    Re: Codeless remove form from library

     OK, I'm not getting an error message anymore, but the form is not going away either.

     A bit of background:  This is a browser form, and originates from a library landing site, i.e. the site intended for general users.  Nothing really submits back to this site.  On initial submit, the form submits to a Submitted form library.  I've tried to get the form to submit back to the library when changes are made, then submit to an Approved library.  Problem is the data changes on the form when re-submitted (from Submitted to Approved status), the form isn't getting deleted, and the form is submitting to the Approved library.

    Am I missing something in the command?  Here it is in an XPath expression:

    concat("DeleteFromSharePoint /url=", "https://forms.corp.integris-health.com/eForms/Staging/_layouts/FormServer.aspx?XmlLocation=/eForms/Staging/Submitted/", ../@my:Key, ".xml")

    Is the path wrong?  The path to the Submitted library is https://forms.corp.integris-health.com/Staging/Submitted.  If you need the rules, I'm attaching to form if you could take a quick look.

    Thanks.

  • 06-04-2013 11:37 AM In reply to

    • TomRenfro
    • Top 75 Contributor
      Male
    • Joined on 09-29-2011
    • Oklahoma City, OK
    • Posts 134

    Re: Codeless remove form from library

     I've made a discovery.  When there's not a Close Form rule that's associated with the Save button (revealed after initial submission), the form I'm wanting to delete gets deleted with the qRules command as above.  If I add a Close Form action immediately after submitting to the Approved library, the form stays in the Submitted library.  I noticed that when I took the Close Form action out and clicked the Close button, the form prompts me as if changes were made to the form, although the status was posted back before deleting.  Is there a way around this action, in other words, close the form without user prompt and still get the form in the existing library deleted?

  • 06-05-2013 09:15 AM In reply to

    • TomRenfro
    • Top 75 Contributor
      Male
    • Joined on 09-29-2011
    • Oklahoma City, OK
    • Posts 134

    Re: Codeless remove form from library

     Does this mean there's no answer to my issue?

  • 06-05-2013 09:24 AM In reply to

    Re: Codeless remove form from library

     Sorry, Tom - I've been meaning to get back to this and give it a try, but haven't had time - I'll see if we have someone who can try to reproduce this.

    Hilary Stoupa

  • 06-05-2013 10:33 AM In reply to

    Re: Codeless remove form from library

    Hi Tom,

    Yes, the path in the URL above is wrong. You want to use the path to your form library.

    Thanks,

    Patrick Halstead
    Project Manager at Qdabra
  • 06-05-2013 01:01 PM In reply to

    • TomRenfro
    • Top 75 Contributor
      Male
    • Joined on 09-29-2011
    • Oklahoma City, OK
    • Posts 134

    Re: Codeless remove form from library

     Crossing my fingers, I think I finally got it to work reliably, with a Close Form rule.  I had to add a simple workflow to the first iteration of the form that populates the URL path attribute.  I used SharePoint Designer to construct the workflow.  It has 1 step, if the current item of the URL variable is empty, the set the variable to the encoded absolute URL of the current item.  This runs on the target library when new items are created.

    Then I added a rule when a button is clicked to save the form to the next library.  Here's the qRules command: concat("DeleteFromSharePoint /url=", @qRulesURL)

    I've tested several forms in a row, making sure the ID of the form doesn't contain special characters.  That was another issue I ran into, but thanks to a previous lab by Hilary I used the translate() function to replace those characters.

    Can anybody see any holes in this approach, or have any idea why the command won't work without the workflow? My theory is the actual encoded URL points to a different path, since our outward facing pages are secured in SharePoint by application certificates, not the entire site.

  • 06-10-2013 03:49 PM In reply to

    Re: Codeless remove form from library

     I suspect that having the form open is taking a lock and preventing deleting.   Why having a close rule would behave differently than without isn't clear.

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