We help IT Professionals succeed at work.

Infopath rules and query a data connection to capture form ID

kdschool
kdschool asked
on
3,617 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.
Comment
Watch Question

Clay FoxDirector of Business Integration
CERTIFIED EXPERT

Commented:
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.

Author

Commented:
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.

Author

Commented:
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?
Clay FoxDirector of Business Integration
CERTIFIED EXPERT

Commented:
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.

Author

Commented:
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.
Director of Business Integration
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
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.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.