Solved

Infopath rules and query a data connection to capture form ID

Posted on 2013-11-18
7
2,482 Views
Last Modified: 2013-12-11
I have a form working and providing a unique identifier for the form name.  I need a way to capture the unique sharepoint ID assigned to each form on submit.  One thing I read was to add a action to query the data connection before the submit and then add an action to set the fields value where the value on my form storing the generated ID will equal the value of the sharepoint assigned ID.

I have to have a unique Id for each form and my data does not lend itself to that.

Can someone explain how to do this for me.  I have tried several things and can't get it work as I am not clear on how to do it.
0
Comment
Question by:kdschool
  • 4
  • 3
7 Comments
 
LVL 28

Expert Comment

by:clayfox
Comment Utility
Not exactly sure what you mean but here is best practice if you want to track submissions.

1. Create the unique file name for submitted records / forms to SharePoint in a field in your data source.
2. Then use that field in the submit wizard for the SharePoint submit

This gives you the ability to store the name in the form. That way on subsequent opens or to check metadata is very easy.

Not sure if this is your case but some people create the unique in the data wizard but then it is not persisted in the form.

Another option is to query submits to the library and then look at created times and username of the created by, but this is not fool proof like just saving the file name inside the form.

Otherwise would need more information or examples of what you have.
0
 

Author Comment

by:kdschool
Comment Utility
Using instructions from this URL
http://social.msdn.microsoft.com/Forums/sharepoint/en-US/689e681f-d46a-4621-a0cf-55fd49a0432a/i-want-to-display-the-id-of-an-infopath-form-after-submission-to-a-doc-library-on-sharepoint?forum=sharepointcustomizationlegacy

I got the form working with auto generating file name. I am confused on this step:
The next step should be an action to "Set a Field's Value."  This is where you'll want to set the value of your form's ID field to the ID node of the secondary data connection WHERE strFilename (SharePoint) is equal to strFilename (InfoPath).  Here, you are using a filter to compare the filename saved in the form to the filename saved in the form library.

I am not clear on what he is telling me to do .  I don't understand how to create the filter to compare the two files names and then return that to the form.
0
 

Author Comment

by:kdschool
Comment Utility
I don't really understand where I should create these two items can you explain?

1. Create the unique file name for submitted records / forms to SharePoint in a field in your data source.  ( in my infopath data source or on the sharepoint library form site or both? and can I name that field anything or does it have to be ID?)

2. Then use that field in the submit wizard for the SharePoint submit .  Are you saying here to select this field after it's created when I complete the submit wizard for the submit button? Then tie the field I created to what field during this process that would show the ID for that record?
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 28

Expert Comment

by:clayfox
Comment Utility
1. Add a field to your main data source. Name it filename. It does not need to be promoted to the library since it will be the file name (title).
Not sure how you name your files currently but would setup a rule on load with the condition that filename is blank then the action concat(ID, now()) This would set a unique file name for each record but only when it is initially started. Not sure if you have an ID like for employees, or whatever but would want a unique naming scheme. If you need to wait until right before submit to determine the name move this rule to the submit button rather than onload. Make sure to use the is blank condition, otherwise if you edit later and resave it would create a new file with a new name instead of saving over the original.

2. In the data connection wizard for submit to SharePoint, you would select the filename field for the name, and follow through the wizard.  That way the value in filename is used.
0
 

Author Comment

by:kdschool
Comment Utility
I have it working with a unique file name concatenating date time and employee ID and each time I edit the form it writes over and when I add a new one it knows if it's blank to create a new entry.  I want to display the ID of an infopath form after I submit it to my library in sharepoint.  From what I understand that is the only really unique ID for any record.
0
 
LVL 28

Accepted Solution

by:
clayfox earned 500 total points
Comment Utility
If you put the concat(now(),EmpID) into a field in the form, and use that for the submit then just expose that field in your view to show the user.
There is a GUID that SharePoint generates but not sure why you would want that or the user would care.

You can also create a data connection back the library you submit to and query that if you want to double check that it was saved.

Not sure what issue you are trying to address here.  If this is just informational to the user, then I think you should be fine.  Why do you want to display the name?  So they can find it later?

Another option is to make an admin form or edit form which links to the library and can pull the promoted information. This way you can give search or a filtered list for files just from a certain employee ID, etc.

I guess one questions is I assume you are using a submit data connection and a button and not allowing users to "save" forms.  Saving is not good practice since you do not have much control whether on the initial submit or on follow up ones.
0
 

Author Comment

by:kdschool
Comment Utility
Yes what I need is a unique name so they can not enter a duplicate form and find it easily if it they need to edit the information.  I am using a submit button.  I thought there were issues about this if you did not use the share point assigned unique ID.  It looks like those only exist if you are transferring files.
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

The Scenario: Let’s say you have a quote worksheet in Excel that you use to work up sales figures and such for your clients. You utilize SharePoint to manage and keep track of these documents. You would like values from your worksheet to populate Sh…
If you create your solutions on SharePoint sooner or later you will come upon a request to set  permissions of the item depending on some of the item's meta-data - the author, people assigned as approvers, divisions, categories etc. The most natu…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now