I am creating a custom site workflow using visual studio2010 for sharepoint foundation2010. My workflow sequence is as follow:
1) I started the site workflow using code as item is created in external list.
2) A approval task is created in Task List.
3) As the task is approved by user I create a list item in my custom list and I capture the custom list ItemAdded event.
4) On ItemAdded event I update approval status in external list item. ( here i am getting error).
In step 4, As I access external list item or any of its property, I am getting error "Access denied by Business Data Connectivity". I try to debug and find that the web.CurrentUser is
I try to give permission on BCS to this user, Sharepoint don't able to find this user in people picker. I added the user
NTSecurity\System user to bcs permissions list in central admin. but still same error.
Also I try with SPSecurity.RunWithElevatedPrilivages but still the same error is occurred.
I try to find it and get that workflow is always run with the Sharepoint\System account context.
I create same workflow with sharepoint designer2010 and its working fine.Read more...