Sunday, 22 July 2012

Add Item to External List using Site Workflow


when trying to add new item to external list while running a site workflow a strange error appears
"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack"
and the sharePoint Redirects me to access denied page
I tried to execute the below steps to figure it out
1- check the current user and BSC permissions :

as you can see the user already been granted full permission
2- check the External Content Type Authentication mode

the current user identity is selected
3- I checked the SQL server Login and Also the user amr-pc/amr got a valid login to the target database
after a while I recall that BSC used the Service account to connect to External List
In order to achieve that
First we create a Secure Store Service
central administration->Manage Service Applications->Manage Secure Store Service
Application and select manage
before adding new Secure Store service Target application you will have to provide a Key if it's the first time

afterwards you can create your Secure Store target application
1- set the application ID

In the last step sepcify the target application administrators and members be sure to add all authenticated users to the secure store target application

after creating the target application select the created application and choose the Set Credentials button from ribbon

Type the target user which will be used to access the remote SQL server database
go to the sharePoint designer and Edit the External Content Type authentication to be Impersonate windows account add the localhostServices "or the application ID you entered while creating the target applicatoin "as the application id in both default and client tab

back to the web browser as you can see below the external list contains 0 items

navigate back to the site workflow and use the initiation form to create an external list Item
Enter the following data First Name: Amr
Last Name: Fouad
Title : SharePoint Developer
press create

now navigate back to the external list you will find the newly created record


and that's it Vola! you can now access the external list within the site workflow

Related Articles