in

Dot Net Mafia

Group site for developer blogs dealing with (usually) .NET, SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, and other Microsoft products, as well as some discussion of general programming related concepts.

This Blog

Syndication

Archives

Corey Roth [MVP]

A SharePoint MVP bringing you the latest time saving tips for SharePoint 2013, SharePoint 2010, Office 365, SharePoint Online, MOSS 2007, ASP.NET, LINQ, and Visual Studio 2012.

Adding a Default Action to a Business Data Catalog Entity

I tend to write the most about things that I am currently working with.  Today I have been working with the Business Data Catalog (BDC) again and I thought I might point out how to configure a default action because it isn't very well documented.  A default action is the URL, that will be used when a user clicks for details on the item (either in a BDC webpart or Enterprise Search results).  I personally discovered it because I saw an attribute in an example somewhere that had nothing to do with this topic.  First, I'll go back and explain how to create an action to begin with.  Most BDC tools will do this for you now, but what does it actually emit in the XML?  Also of note, a lot of tools will let you create the action but not set it as a default.  Here is what typical XML looks like.  It goes in the Entity element.

<Actions>

  <Action Position="1" IsOpenedInNewWindow="false" Url="{0}" ImageUrl="" Name="Default">

    <ActionParameters>

      <ActionParameter Name="SiteUrl" Index="0" />

    </ActionParameters>

  </Action>

</Actions>

The URL allows you to inject the value of a column similar to that of String.Format() using {0} etc.  This can be useful if you need to specify a different protocol besides http (i.e.: file://) or if you needed to construct the URL using multiple columns.  To set up a default action, you need to take a note of what you named the action (in this case I called it Default).  This is how you tell it which action to use as a default.

Now that we have recapped how to create an Action, we need to specify that its a default action.  This is actually pretty easy.  Create a new Property element in the Properties element of the Entity.  Give it an attribute of DefaultAction and specify the name of the Action we defined earlier.  Here is how it looks.

<Property Name="DefaultAction" Type="System.String">Default</Property>

When you import the application definition, you will receive a warning like the following. 

 Could not create profile page for Entity MyEntity.  The error is: Default action exists for application 'MyInstance', entity 'MyEntity'.  Profile page creation skipped.

This really isn't an error.  It is just telling you that since you specified a default action, it did not automatically generate a profile page for the entity. That's all there is to it.  Hopefully, more tools will start supporting it out of the box soon.

Comments

 

tschuege said:

Hello

thanks for the explanation.

It all works in my case, except of the DefaultAction. When i create an external list of a external content type having the default action defined, it still opens the "View Item" dialog when i click on the link directy. The action is available in the context menu but it does not seem to be the default action.

Any idea?

Thanks, kind regards

Tschuege

September 7, 2011 8:27 AM

Leave a Comment

(required)  
(optional)
(required)  
Add

About CoreyRoth

Corey Roth is an Applications Architect at Infusion specializing in ECM and Search.
2012 dotnetmafia.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems