Search code examples
sharepoint-2010infopath2010

Infopath data connection to sharepoint: how to avoid hard coded list id?


I've created a infopath 2010 form with a connection to a SP list. This connection allows me to populate a drop down list. This is working as expected if I work on an existing site.

Now I want to publish this form as a task form of a workflow feature. the workflow is part of a site template that also defines some list instances. As list instances have new IDs each time they are created, the form data connection won't work (listID and spweb absolute url are hard coded in the data connection in the xsf file).

Is there a clean way to allow me to populate a DDL in infopath without the actual list id ? In fact, can I bind to "lists/mylist" instead of {myguid} ?

thx


Solution

  • (angry against Microsoft for using guids everywhere without the ability to control them).

    I finally followed this approach :

    1. In my forms, I converted the data sources to datasources shared in the host sp site. This generated for me the udcx files.
    2. Then, I created, in VS 2010, a feature with a module to provision a DataConnection library, holding all this udcx files. In this udcx file, I replaced the GUID with tokens like $listguid$ or $weburl$
    3. I also wrote a feature receiver to replace, after provisioning the module, my tokens with the actual values

    quite painful and very disappointed with this big holes in SP development processes