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.
ProjectDetails Table:
"ProjectDetails" table has the following items.
Project Details External Content Type:
- Open SharePoint Designer 2010.
- Click on Open Site.
- Enter the site URL and click on Open.
- Go to Navigation => External Content Types
=> New => External Content Type.
- Enter the details as shown in the
following.
- Click on the link "Click here to discover
external data sources and define operations".
- Click on "Add Connection".
- In the External Data Source Type
selections select "SQL Server" and click on Ok.
- Enter the details as shown in the
following.
- Right click on ProjectDetails table and
click on "Create all operations".
- Click Finish.
- 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.
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:
- 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".
- 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).
- Click on Ok.
- An action is added successfully to the
external content type as shown in the following.
- 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.
- When you click on the action it will be
redirected to the newform.aspx as shown in the following.
Add Business Data Actions web part:
- Go to the SharePoint site.
- Go to Site Actions => Edit the Page.
- In the ribbon interface, go to Editing
Tools => Insert => Web Part.
- In the Categories, select Business Data =>
Business Data Actions.
- In the type, select the "Project Details"
external content type.
- In the actions, click on "Choose".
- Select the action that we have created as
shown in the following.
- Click on Ok.
- Now the web part will display all the
actions that we have created as shown in the following.