Chaks' Corner

SharePoint and other stuffs

30. May 2010 20:39
by Chaks
19 Comments

BCS: Showing a friendly display name on the External Item Picker control

30. May 2010 20:39 by Chaks | 19 Comments

Associations in BCS are a great way to relate two external content types based on a foreign key. It is actually very easy to create an association using SharePoint Designer 2010 – no code required!

 

You can read more on the following blogs posts to know more about associations:

 

1) The Notion of Associations and the External Item Picker

 

2) Tooling Associations in SharePoint Designer 2010

 

If you want to know quickly how can Associations help me, consider the picture below:

 

image

 

The Sales Order table has a column CustomerID which is actually a foreign key in the Customers table.

 

If you create Sales Order external list, you will notice that you get a text field for entering the CustomerID, which isn’t that helpful:

 

image

 

But if you create an association, then you get an external item picker where you can filter/select the customer:

 

image

 

If you read the blog post which I pointed out earlier, it says:

 

 

“……it’s possible to show a friendly display name on the external item picker control upon customer selection to show something more meaningful that the number that identifies the customer in the external system, for instance the customer name, or whatever field that is tagged as the title field in SPD.”

 

 

But how do you ‘tag as the title field in SPD’ ?

 

Well, it turns out it is very easy and simple!

 

Set Field as Title

 

In your external content type Summary View, select the field you want to ‘tag as the title’:

 

image

 

In the Ribbon, select Set as Title:

 

image

 

Now, you will be able to see that field, whatever is set as Title in the external item picker instead of the default identifier field

Comments (19) -

Kylie

Handy tip thanks Chak! Would be even more useful if it displayed the new 'title' in the list view as well, in place of the foreign identifier. Know of a workaround to get the more relevant title to show up in your external list, instead of the foreign identifier?

Jeremy THake

That is great for create/update/view screens but on list view the ID still shows! Such ashame, could have been really powerful! Some other button to push maybe?!?

Jeremy THake

Also just noticed can't group or sort by BCS Association Columns either.

Chaks

@jeremy - I am able to sort (Ascending/Descending) and also filter based on the association column, except that it will not be based on the 'friendly name'.

chakkaradeep

@Kylie - when you say 'list view', is it adding the external list web part?

If so, I just added that by going to Insert->Existing List and added my external list. The default view it adds is crap. So, edit the web part and choose the appropriate view. You will now exactly get as in the list. View or Edit, the external item picker should show the field whatever is set as Title.

Kylie

I basically meant what Jeremy was saying - in the external list view you still see your foreign key as opposed to your title - works fine in the new item/update/view item form though.

Chaks

Ah..ok. I think this 'friendly name' currently applies to item edit/update/view.

Chaks

Ok, I can confirm the 'friendly name' is not an option in the List View.

Luke McGregor

I havent found a way of displaying the friendly name in a list view short of using a .NET connector

chakkaradeep

@Luke - would be great if you can share Smile

Simon

We're trying to do our complete development using VS2010, so do you know if its possible to set the Title field in Visual Studio?

Thanks!

chakkaradeep

@Simon - Since you are building your BDC model and methods using VS2010, where you have the total control, I don't see why you wont be able to show any other field (as Title field).

VamshiKgovind

Hi Simon,

You should be able to do that by following this steps:
1. Select the Entity and select the properties.
2. In the Custom Properties section, add the following:
   Name : Title
   Type : System.String
   Value: FieldName you want to come up as title.


Alternately you can open the BCS model in XML editor and add the following tag in the properties of the entity:
  <Property Name="Title" Type="System.String">FieldName</Property>

Dikran


when you click the small button next to the textbox to open the Modaldialog, select an item, and click add(Multiselect is set to true), the BDC Identity of the entity Instance is displayed in the textbox instead of the identifier or the tile. Note this is only in the textbox of the modal dialog not the original textbox.

Do you how might I control this?

chakkaradeep

@Dikran - I need to test your scenario. Will see what I can do.

chakkaradeep

@Dikran - How did you enable multi select for the external item picker?

Dikran

Hello,

There's a proeperty on the external item picker called MultiSelect. Set it to true from the markup or onInit.

<SharePoint:ItemPicker MultiSelect=true id="YourEntityPickerID"

chakkaradeep

@Dikran - I am also getting the exact behavior as yours. Investigating now. Will post a reply @ MSDN forums once I resolve it and also blog about it Smile

VamshiKgovind

Hi,

I have two quries:

1. When a field is selected as title for an entity that has associations, In the external picker results only titles are shown instead of the whole grid information. Is there a way to set the picker control to display other fields as well?

2. Did anybody figure out a way to display the title instead of id in the list view for an associated field ?

Cheers,
Vamshi

Comments are closed