Print SharePoint ID in InfoPath Form - InfoPath Dev
in

InfoPath Dev

Print SharePoint ID in InfoPath Form

Last post 10-29-2012 08:13 AM by Hilary Stoupa. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 09-22-2011 12:38 PM

    Print SharePoint ID in InfoPath Form

    Hello:  I need your help with printing the SharePoint 2007 (form library) ID number in the form library's InfoPath 2007 form.

    Goal:  A user goes to the SharePoint 2007 form library, clicks to open a filled-out form that has been submitted to that library, and then clicks the Print icon in InfoPath to print a view of the form that contains the SharePoint form library (document) ID.

    What I did:

    1.  I added the SharePoint document ID column to the default library View.

    2.  I added a Print view to the InfoPath Form containing a text box bound to the SharePoint document ID.

    What it actually does:

    The Print view in InfoPath does indeed display and print a SharePoint document ID, but not necessarily the one associated with that particular form.  It prints the TOP-OF-THE-DEFAULT-VIEW ID in the form library.  So, if the SharePoint default View sorts on ID descending, a user opens a new form from SharePoint, fills it out and submits it, closes it, then opens the form from SharePoint and prints it immediately, the ID is correct.  Say it's number 273.  But if three other forms are submitted in the meantime, and then the user goes back to print form 273, form 273 will display and print ID 276 -- the ID now at the top of the View due to its Sort configuration.  If the View's Sort is changed to ID ascending, then form ID 273 will print ID 1, because 1 now appears at the top of the View.

    What am I missing?  I've got the feeling it's something obvious...

    Other possibly important details:

    • The Binding is configured as follows:

    Field name:  ID

    Data type:  integer

    No Validation or Rules are applied.

    Text Box field, binding to Secondary data source

    • The form is not browser-enabled.
    • The form uses cascading fields that get their values from SharePoint Lists, and that part works fine, along with everything else in the form and in SharePoint.
    • There is no custom code in the form.

    Thanks for your thoughts...!

     

    [Update 2011-09-23:  I think the informationI need is how to filter to just get that particular form's ID.  I have a field in the form called "Doc-Name" that is unique and this populates the Name field in the SharePoint form library, but I just can't figure out how to make the form filter to get its own ID.  I do understand the form has to be submitted first in order to be assigned a SharePoint ID.]

  • 09-30-2011 07:41 AM In reply to

    Re: Print SharePoint ID in InfoPath Form

    bump

  • 09-30-2011 08:59 AM In reply to

    Re: Print SharePoint ID in InfoPath Form

    Hi - you need to filter your secondary data source that contains your SharePoint Id. Drag the secondary data source onto your form temporarily so you can see all the data in it - then you'll know which field you can use to compare to the Doc-Name field in your form.

    Instead of having a text box bound to your 2DS - just use an expression box (calculated value in IP 2010). For the XPath for the expression, select the ID field from the 2DS and in the formula editor, click the Filter button. Your filter will be the Doc-Name field in your main DS is equal to the Title field (or whatever field contains that info) in the 2DS.

    Hilary Stoupa

  • 09-30-2011 10:12 AM In reply to

    Re: Print SharePoint ID in InfoPath Form

    Thank you so much for your reply; exactly what I needed!  I also discovered I was attempting to filter on the wrong field.

  • 09-30-2011 10:19 AM In reply to

    Re: Print SharePoint ID in InfoPath Form

    When I started using InfoPath, I used to work blind all the time, just sort of guessing what was going on in my secondary data sources. My ability to solve my own issues greatly improved when I started dragging data sources onto the form with complete abandon. I don't know why I was so hesitant at first - I guess I'd invested too much time in making my forms look pretty, and hadn't realized that it was pretty easy to drag stuff on and delete it afterward. Or create a debug view - put all your ugly figuring stuff out things in that view. I'm glad you got your issue squared away!

    Hilary Stoupa

  • 10-27-2012 06:14 AM In reply to

    Re: Print SharePoint ID in InfoPath Form

     Hello, I found this entry and I must say THANK YOU!!! I have been battling how to grab the SharePoint ID and the idea of using an expression never crossed my mind. I used other forum entries with no luck so once again...THANKS!! If you are still making entries, I will definitely follow up with you on future efforts.

    Bernard Angelo Townsend
  • 10-29-2012 08:13 AM In reply to

    Re: Print SharePoint ID in InfoPath Form

    Hey, I'm so glad this was helpful to you & welcome to the forum!
    Hilary Stoupa

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