Using Multiple Contact Selectors

First of all I would like to say that most credit goes to Scott Heim who wrote this great article earlier about using the Contact Selector.

With that said, now let’s get started on more tips and tricks on this userful control.

Now let’s see how our datasource looks like, after applying the steps in the Scott Heim’s guide.

Figure 1.1

Figure 1.1

Most people will want to use this control several times in their form. The problem is that InfoPath will not allow duplicate element names in the form’s datasource. Therefore, it is impossible to repeat the same datasource heirarchy which this control depends on.

Now to demonstrate how to overcome this problem, let’s check out the following steps:

  1. For the sake of the example, let’s say we have a repeating table, where I want each row to have it’s individual contact selector.
    We will start by creating the datasource for this table, you should have something looking like this:

    Figure 1.2

    Figure 1.2

  2. Now that our table datasource is ready to receive it’s ContactSelector.
    Rigth click on the original contact selector datasource “gpContactSelector” which we created earlier, and click Reference.

    Figure 1.3

    Figure 1.3

  3. Now choose the destination of the contact selector control reference.

    Figure 1.4

    Figure 1.4

  4. Almost done, now to test it, right click “grpRepeating”, and choose “Repeating Table”.

    Figure 1.5

    Figure 1.5

  5. You can see that the table was created but the last row has been rendered as a repeating section. Now right click the parent “Optional Section”, and choose “Change To”, then choose “Contact Selector”.

    Figure 1.6

    Figure 1.6

  6. And you’re done 🙂 , this should be your final result.

    Figure 1.6

    Figure 1.7

Please check back for more Tips & Tricks 🙂 See Ya!

Advertisements

One comment

  1. Great article, how do you get this working in IPFS as a browser based form. I get a Null reference exception when trying to upload the .xsn template. If remove the nested control, no problem, as soon as I hit “change to” and then publish. The .xsn will not upload.

    I would be greatful if you could tell one way or the other whether it possile to use this article for a browser based form.

    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s