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.