SharePoint 2007: BDC - Custom Actions on your Entities

Posted on 4/24/2007 @ 5:19 AM in #SharePoint by | Feedback | 19235 views


SharePoint 2007: BDC - The Business Data Catalog

This post is in continuation to a series of blogposts I put up on BDC - the Business Data Catalog.

Table of Contents:

  • Introduction
  • In-built Webparts
  • Lists with Business data type columns.
  • Search
  • User Profiles
  • Other custom applications targeting a common runtime object model.
  • Making it easier to author XML Applications: BDCMetaMan

    In my series on BDC, I just got done describing a somewhat complete business data application definition, that lets you import data from Northwind.Customers. I provided both a Finder method and a specific finder method. In this blogpost, I am going to demonstrate adding custom actions to the various entities on your list.

  • You already have an action called "View Profile". What if, I wanted to add a custom action, that allowed me to issue a search on live.com for the user?

    To achieve this, use the following steps -

    • Start with the XML Goo you already used here.
    • In the definition for the entity where you want to add the custom action (i.e. under the Customer Entity in our example), right after </Methods>, copy paste the following XML -
    • <Actions>

        <Action Name="Live it!" Position="1" IsOpenedInNewWindow="true"

                Url="http://search.live.com/results.aspx?q={0}" ImageUrl="">

          <ActionParameters>

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

          </ActionParameters>

        </Action>

      </Actions>

    • Umm .. thats it ! (Seriously, it is that easy)

    As you can see above, the parameter "ContactName" will be substituted at index "0", which is specified as a querystring URL to search.live.com.

    Save and Redeploy the application using the following steps -

  • Go to the SSP
  • Click n Business Data catalog//view applications --> Delete the previous application (or you could also version, but I'm gonna be lazy and consistently lazy)
  • Click on Business data catalog//import application definition
  • Browse to the Xml Goo as your "Application Definition File", choose to import as a "Model", and hit "Import"
  • Now go ahead and use the application exactly as I described in this blog post here. and you should see the custom action show up as shown below -

    Clicking on that, will issue a search on live.com for "Elizabeth Brown". :-)

    Sound off but keep it civil:

    Older comments..


    On 2/24/2008 10:13:48 AM gabriel said ..
    Thanks, great tutorial, the best aboy bdc in sp.

    Excellent , many thanks for share your knowledge.


    Gabriel


    On 3/21/2008 12:34:32 AM phani said ..
    Hi,

    I followed the exact steps as you mentioned, but i could not able to see either Live it! or Veiw Profile under ContactName.. By chance anyone reported this problem to you anytime.. I am desperately trying to fix it.. but could not able to do so.. if you know of anything please let me know... any example or reference or hotfix would be helpful.. by the way i am using MOSS SP1

    Regards,


    Phani


    On 5/22/2008 2:28:07 AM Dan said ..
    phani

    I am also on SP1 and the steps worked fine for me.

    I have had a few errors (my fault) and found that the error logs were really good for working out what went wrong.

    ps, Great set of posts... very easy to understand.


    On 7/15/2008 12:42:48 PM Christina Odom said ..
    Random question about your custom action. I implemented this very action, however the parameter turned into "Elizabeth+Brown" instead of "Elizabeth Brown" I know this has to do with the encoding of the space. Have you come across this and if so, how can this be resolved?


    On 8/20/2008 5:19:59 AM Marius said ..
    Great post, thank you


    On 9/15/2008 3:55:32 PM Ali said ..
    Excellent instructions. I was able to query a SQL DB on a single field and display 4 fields on the returned set. However, only "is equal to" works correctly. For example if is equal to James returned results, starts with Jam did not. How can I fix this. Also, how can I make any of the other 3 fields I'm returning also searchable?


    On 9/25/2008 10:04:51 AM Aaron said ..
    Great post, a quick question though. I've noticed that if you click the default action item it seems to ignore the IsOpenedInNewWindow attribute and navigates to the url in the existing window. If you execute the action via the action menu the expected behavior does happen; ie the url is opened in a new window. Am I missing something here?


    On 12/2/2008 6:17:17 PM Eric Swanson said ..
    Fantastically most excellent Sahil! After reading these tutorials, I don't know why ANYONE would answer "NO" to your survey example. Please keep up the awesome community sharing. Who knows, maybe I will be inspired to do the same when I can find some darn time.


    On 2/3/2009 10:43:53 PM Jose said ..
    I battled trying to find a way to display the actions link inside a BDC data list web part. Then by accident I edited the view on the BDC data list web part and selected one of radio buttons next to the column name.. There it was the action menu displays...! I hope this saves you tones of time...


    On 3/5/2009 5:49:55 PM Mario said ..
    Hello, I have implemented the actions on the Entity, but regarding the parameter being passed, it will go with the enconding character "+", how do I trim this character from the parameter string? Thanks