2

I am having a SharePoint custom list which is having a designer workflow and event receiver attached to it.

In the event receiver on ItemUpdating event I am having the below code to check if a particular column value is changed or not.

if(properties.ListItem["ColumnName"] != properties.AfterProperties["ColumnName"]))

It gives proper result if item is updated manually, but when the workflow updates any item properties.AfterProperties["ColumnName"] gives always null value. So the if condition always gives result as true.

Moreover I call a method to update a SQL table when the above condition gets satisfied. But when the code tries to open the SQLConnection it gives an exception like:

"Cannot open database "DBName" requested by the login. The login failed. Login failed for user 'NT AUTHORITY\NETWORK SERVICE'."

Again, the same works when item is updated manually.

Any help how to handle this situation.

0

I figured out the problem, actually properties.AfterProperties["ColumnName"] was giving values as I was assigning the same value when I was updating the list item from the custom form.

  • Could you mark your answer as "accepted" so that your questions does not pop up as "unanswered questions" anymore? Thanks. – jcp Oct 27 '15 at 10:44
  • I want to learn from your answer but I don't get it.. Could you please rephrase it? Also how about the SQLConnection problem? – Mark L Jul 28 '16 at 2:21
0

Go to your SQL server in security Folder right click into Login and add new Login,after that type the "NT AUTHORITY" and click search, after that put this "IUSER" and click check Names,and click ok , and its will add the user login, after that right click into the user you added and choose properties choose User Mapping and check the table Name that you want to work on it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.