• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3182
  • Last Modified:

Infopath rules and query a data connection to capture form ID

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.
  • 4
  • 3
1 Solution
Clay FoxDirector of Business IntegrationCommented:
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.
kdschoolAuthor Commented:
Using instructions from this URL

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.
kdschoolAuthor 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?
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Clay FoxDirector of Business IntegrationCommented:
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.
kdschoolAuthor 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.
Clay FoxDirector of Business IntegrationCommented:
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.
kdschoolAuthor 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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now