Business Data Actions Web Part in SharePoint 2010


Introduction:

An Action is a something that can be performed on a single row of data returned by BCS. Using a URL with parameters you can configure an action to be performed. The Business Data Actions web part will display the list of actions for you.

Data Source:

I have created a database in SQL which has a table with some data.

BusDtSha1.gif

ProjectDetails Table:

"ProjectDetails" table has the following items.

BusDtSha2.gif

Project Details External Content Type:

  1. Open SharePoint Designer 2010.
  2. Click on Open Site.

    BusDtSha3.gif
     
  3. Enter the site URL and click on Open.
  4. Go to Navigation => External Content Types => New => External Content Type.

    BusDtSha4.gif
     
  5. Enter the details as shown in the following.

    BusDtSha5.gif
     
  6. Click on the link "Click here to discover external data sources and define operations".
  7. Click on "Add Connection".
  8. In the External Data Source Type selections select "SQL Server" and click on Ok.

    BusDtSha6.gif
     
  9. Enter the details as shown in the following.

    BusDtSha7.gif
     
  10. Right click on ProjectDetails table and click on "Create all operations".

    BusDtSha8.gif
     
  11. Click Finish.

    BusDtSha9.gif
     
  12. Save the external content type.

Set the permissions:

Once you have created the external content types using SharePoint Designer , Go to Central Administration => Application Management => Manage Service Applications => Business Connectivity Service application => you could be able to see the external content type that you have created using Designer as shown in the following.

BusDtSha10.gif

Set the permission for the external content type (Refer http://www.c-sharpcorner.com/UploadFile/anavijai/4252/).

Add an action to the external content type:

In this section I am going to add a simple action to the external content type which will add a new item to the external list.

To add an action perform the following steps:

  1. Go to Central Administration => Application Management => Manage Service Applications => Business Connectivity Service application =>"Project Details" external content type=> Click on the drop down menu => Select "Add Action".

    BusDtSha11.gif
     
  2. Enter the Name, navigate URL http://servername:1111/hr/MP/Lists/External%20List/NewForm.aspx (will be redirected to newform.aspx to add the new item to the external list).

    BusDtSha12.gif
     
  3. Click on Ok.
  4. An action is added successfully to the external content type as shown in the following.

    BusDtSha13.gif
     
  5. I have created an external list based on the "Project Details" external content type and in each item you can see the action that we have created as shown in the following.

    BusDtSha14.gif
     
  6. When you click on the action it will be redirected to the newform.aspx as shown in the following.

    BusDtSha15.gif

Add Business Data Actions web part:

  1. Go to the SharePoint site.
  2. Go to Site Actions => Edit the Page.
  3. In the ribbon interface, go to Editing Tools => Insert => Web Part.
  4. In the Categories, select Business Data => Business Data Actions.

    BusDtSha16.gif
     
  5. In the type, select the "Project Details" external content type.

    BusDtSha17.gif
     
  6. In the actions, click on "Choose".

    BusDtSha18.gif
     
  7. Select the action that we have created as shown in the following.

    BusDtSha19.gif

     
  8. Click on Ok.
  9. Now the web part will display all the actions that we have created as shown in the following.

    BusDtSha20.gif